Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL with EL not evaluating expressions on JRun 4.

 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a couple of questions all rolled in to one here...

First I'm trying to use JSTL with JRun 4. I have the core working, but EL is not. When I type a loop like such

<c:forEach var="i" begin="1" end="10" step="1">
<c ut value='${i}' />
<br />
</c:forEach>

The output is just 10 lines that all display ${i} instead of the value of i.

I don't understand why this is happening since I believe I'm configured to use the version of core that supports EL. My import looks like this.

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

And in my web.xml file it is configured as this.

<taglib>
<taglib-uri>/WEB-INF/c.tld</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

I'm not pointing to Sun for the URI, because it causes a bizarre error message, but I don't believe that should make any difference since I have all of the tlds residing on my local server.

If anyone can help I'd really appreciate it.

Also, is JSTL considered to be THE tag standard? I have heard of a lot of people using the Struts tag libs instead. I would just like to know what is really the industry standard.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the core working, but EL is not.


Are the JSTL tags being evaluated? (I am assuming so, but just checking).

I'm not pointing to Sun for the URI, because it causes a bizarre error message,


URI's don't "point" anywhere, they are just strings that just happen to look like URLs. I'd recommend using the standard URIs and figuring out why they are not working rather than using a work-around that could cause other problems.

You should not have a copy of c.tld in your WEB-INF, but rather be relying upon the c.tld file that is bundled with the jar files of the JSTL. That waym there's no chance of a version mismatch.

Also, is JSTL considered to be THE tag standard? I have heard of a lot of people using the Struts tag libs instead.


Yes, that's what the "S" in JSTL stands for. I do not recommend using any proprietary set of tags, Struts or otherwise, in lieu of the standard tag set.
 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

I understand what you are saying. When I run the same page under Tomcat it works fine. There I am using the URI that is recommended for JSTL 1.1 Core.

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

I also do not need to include my .tld files directly into my WEB-INF folder this way. However, when I try to deploy the exact same application to JRun 4 (which is the container required for this particular project) I receive an error message that "Location does not begin with /". So basically JRun is telling me it does not accept any prefix other than forward slash when specifying the URI. I don't know if this is how JRun actually works, or if this is just a problem I'm encountering.

To try and work around this I then defined my taglib in my web.xml file and dumped my .tld files into the WEB-INF folder. This seemed to have some progress since my errors went away and JRun began evaluating JSTL correctly, except expressions will not evaluate now...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So basically JRun is telling me it does not accept any prefix other than forward slash when specifying the URI.


<general-rant>
Why do people pay good money for web containers that just don't work when perfectly fine, working free containers are available?
</general-rant>

Sorry, had to get that out. It wan't directed at you since you propbably aren't the one who decided not to use Tomcat, which, as you have seen, works just fine.

If this indeed is a limitation of JRun, it is broken and not spec compliant. Not sure what more I can tell you at this point.

And since this is container-specific, I'm going to move this topic along to the Other java Products and Servers forum where another JRun user may see it and offer some advice.
 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JRun was definately not my decision. I'm just trying to get JSTL working with it since it is the required server for this project. I would love nothing more than to be using Tomcat, which is what I use at home btw.
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL 1.1 requires JSP 2.0 and JRun 4 supports JSP 1.2

What are the major features of JRun 4 from JRun FAQ?
The top new and enhanced JRun 4 features include:

Certified J2EE 1.3 compatible
High-performance web container with JSP 1.2 and servlet 2.3 support
 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most excellent! So JRun is an even bigger step down from Tomcat than I had imagined...
 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And thanks Carol. I will download the 1.0 version of JSTL and try it out with that.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it might be something like that, but since I haven't touched JRun since about 2001 or so...

Though that still doesn't explain why JRun complained about the URIs not starting with /'s.

Be aware that the URIs for the JSTL libraries are different in JSTL 1.0 than JSTL 1.1.
[ May 10, 2005: Message edited by: Bear Bibeault ]
 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I installed JSTL 1.0 on my JRun 4 server. When I include the core taglib directly in to the jsp page as such

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

then expressions are now being correctly evaluated.

When I use the standard/correct way of including into my jsp page as such

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

with a corresponding entry into the web.xml file like this

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

I am now getting my JSTL tags evaluated correctly, no complain anymore about the URI not beginning with a forward slash. However, when I use the "correct" way, expressions are still not evaluated...

I'm positive that c.tld is the version that evaluates expressions, but I also tried c-rt.tld just in case. That had the same result.

Any ideas?
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to repeat what Bear said. You should not have a copy of the tld's in the WEB-INF directory. You should just have jars in WEB-INF/lib.


You should not have a copy of c.tld in your WEB-INF, but rather be relying upon the c.tld file that is bundled with the jar files of the JSTL.
 
Bloo Barton
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help Carol and Bear. Everything is working for me at the moment. I'm curious though, you say I should not have the .tld files directly in my WEB-INF folder. Instead you say I should be pointing at my jar file (standard.jar). I removed the .tld files and pointed to my standard.jar, this works fine (same as .tld files directly in the WEB-INF).

I understand your reasoning why I should be using the jar files instead of putting the .tld files directly in the WEB-INF folder also, but what truly baffles me here is why do all of the books and documents I have looked over say the opposite? They all say to put the tlds in the WEB-INF folder...
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just googled for jstl getting started and found instructions to drop the jars in WEB-INF/lib and add to jsp:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
[ May 12, 2005: Message edited by: Carol Enderlin ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic