Foren

JSTL Param value in portlet

Rich Hirst, geändert vor 12 Jahren.

JSTL Param value in portlet

New Member Beiträge: 4 Beitrittsdatum: 11.10.11 Neueste Beiträge
Hi,

I'm trying to include some JSP code within another JSP (for e.g. footers and headers) and to pass a parameter to the included code.

I am unable to access the parameter except in the ROOT context(?).

So for example, in my portlet JSP I have:


<%@ page contentType="text/html" %>
<%@ page import="javax.portlet.*" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>

<portlet:defineobjects />

<p class="sstitle">Device Management</p>
<br>
Here we are

<liferay-util:include page="/WEB-INF/jsp/foot.jsp" servletcontext="<%= this.getServletContext() %>">
<liferay-util:param name="theparam" value="stuff" />
</liferay-util:include>


Then in the "foot.jsp" file there is:


&lt;%@ page contentType="text/html" %&gt;
&lt;%@ page import="javax.portlet.*" %&gt;
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %&gt;
<h1>And here we are too!</h1>
${param.theparam}


The result is:

Device Management

Here we are
And here we are too!
${param.theparam} 


If I move the footer from the custom portlet to ROOT/WEB-INF/jsp and remove the servletContext then it appears as it should:


Device Management

Here we are
And here we are too!
stuff 


Any help appreciated!

Rich
Rich Hirst, geändert vor 12 Jahren.

RE: JSTL Param value in portlet (Antwort)

New Member Beiträge: 4 Beitrittsdatum: 11.10.11 Neueste Beiträge
Resolved emoticon

Had missed the page parameter:
&lt;%@ page isELIgnored="false" %&gt;


emoticon