This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes problem with jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with jstl" Watch "problem with jstl" New topic
Author

problem with jstl

rakesh damkondwar
Greenhorn

Joined: Sep 17, 2004
Posts: 9
Hello all,
i have one problem as follows. I am trying to display request paramater value using corejstl tag <c ut value="${param.paramter-name}"/> that i had set in prevoius jsp page. But rather than displaying the actual value of that parameter it is displaying like {param.parameter-name}. The to file are

1.first.jsp
<form .... >
<input type="text" name="address" value="heaven"/>
</form>

2.second.jsp
<form...>
<c ut value="${param.address}"/>
</form>

Output is
{param.address}

i am using tomcat 4.1.24, is there any problem with this version ? Please help me to solve this problem.
Thanx.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
The following example seems to work fine for me.

page1.jsp

page2.jspAre you certain that your server supports JSP 2.0 and that expression language support isn't turned off?
[ September 23, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Ah, I notice now that you said: i am using tomcat 4.1.24, is there any problem with this version ?

That's a problem. Tomcat 4.1.24 doesn't support JSP 2, which includes not supporting the expression language (EL). At http://jakarta.apache.org/tomcat/ notice the little blue table of the Servlet and JSP versions supported by the different versions of Tomcat.

So, if you want to use EL support, you'll have to use something other than Tomcat 4.x.
[ September 23, 2004: Message edited by: Dirk Schreckmann ]
rakesh damkondwar
Greenhorn

Joined: Sep 17, 2004
Posts: 9
Hi Dirk,
i have gone through URL that u sent for this problem. Now i have understood what the problem is, i have to use Tomcat5.x in order to use EL since its a kind of versioning problem. Thankx a lot for helping in this issue.
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
> That's a problem. Tomcat 4.1.24 doesn't support JSP 2

That should not be a problem. EL was first introduced in JSTL 1.0.
And if you look at the Jakarta Standard-1.0 Taglib page, you'll see:

NOTE: Standard-1.0 (JSTL 1.0) requires a JSP container that supports the Java Servlet 2.3 and
JavaServer Pages 1.2 specifications. Jakarta Tomcat 4 supports these specifications.
The Standard 1.0 taglib has been tested with Tomcat 4.1.24.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I am not familiar with the details of JSTL 1.0.

Jean, if I've understood your post correctly, it says that JSTL 1.0 should interpret EL constructs passed to it. Is that what you're saying?

I just tried out the above examples on Tomcat 4.1.30 with JSTL 1.0.6, and the EL construct is not interpreted, as the initial poster experienced.

I did just notice in part 3 of Hans Bersten's JSTL 1.0 article series at O'Reilly the following:

A JSP 1.2 container doesn't know anything about EL expressions, so they are evaluated by code in the JSTL tag handlers.

And in part 1:

All JSTL actions recognize EL expressions in their attribute values, and custom actions may be developed to do the same.

So, the question then is what are the original poster and I not aware of? Why aren't our examples having the EL interpreted?
[ September 24, 2004: Message edited by: Dirk Schreckmann ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
OK. I finally found my problem. I was using the RT libraries, as specified by the following line.

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

Apparently the RT libraries don't interpret EL constructs.

Change that line to

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

and the EL construct passed as the value to the JSTL attribute is interpreted.

rakesh, does this solve your original problem?
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
> Jean, if I've understood your post correctly, it says that JSTL 1.0
> should interpret EL constructs passed to it. Is that what you're saying?

Exactly. Not in any other part of the JSP pages for JSP 1.2 containers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with jstl
 
Similar Threads
problem in displaying dropdown menu items in jsp with jstl
Problem Passing Parameter values to action
JSP 2.0 EL and html:options issue
struts 1 form question
EL not evaluating in td tag