Re: JSTL using EL does not display EL values



On Sep 4, 7:05 pm, Chris Riesbeck <Chris.Riesb...@xxxxxxxxx> wrote:
phillip.s.pow...@xxxxxxxxx wrote:
<pre>
<code>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>

<%!
    String titleText = MyProperties.getValue(MyProperties.CONFIG,
"COMMON_VALUE");
 %>

<c:import url="/header.jsp" context="/common" >
   <c:param name="title" value="${titleText}" />
</c:import>

This is a test to show <b><%= titleText %></b> = <b>${titleText}</b>

</code>
</pre>

However, when I run this script, I see only the following:

This is a test to show User Registration =

Am I missing an important step?

Yes. EL doesn't access local Java variables, only objects stored on one
of the scopes (request, session, page application). First example I
found of what to do (for page scope):

http://www.caucho.com/resin-3.0/jsp/el.xtp

I don't see the value of titleText



that's because I forgot an important step:

<%
String titleText = MyProperties.getValue(MyProperties.CONFIG,
"COMMON_VALUE");
pageContext.setAttribute("titleText", titleText);
%>

<c:import url="/header.jsp" context="/common" >
<c:param name="title" value="${pageScope.titleText}" />
</c:import>




when I use EL to attempt to display it.  The web module's web.xml
deployment descriptor indicates I am using version 2.4 of the XSD as
well as that I am using JSP 2.0 with JSTL 1.2.  Deploying onto
WebSphere 6.0.

Thanks- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

.



Relevant Pages