wood burning stoves 2.0*
The moose likes Servlets and the fly likes JSTL core library tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSTL core library tag" Watch "JSTL core library tag" New topic
Author

JSTL core library tag

Geetu Bahl
Greenhorn

Joined: Dec 01, 2004
Posts: 14
Hi

I have just started working with JSTL and am trying to retrive array elements from a array which is declared and then set as an attribute in a servlet.

I used c:forEach tag. When i run the code, it doesn't display the actual array values, rather it just displays the syntax ${movie}(movie is the var in c:forEach tag)

I am trying this code on websphere.

Thanks
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Is it actually displaying the following?

${movie}

If so, you may want to check to see if EL is ignored in the DD.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Padma Lalwani
Ranch Hand

Joined: Nov 02, 2004
Posts: 49
Hi,
I had faced the same issue im my jsp.
It had to do with incorrect include of jstl core library in my jsp, this include depends on the J2EE version your server supports

I had to use http://java.sun.com/jstl/core instead of http://java.sun.com/jsp/jstl/core as I was using Servlet 2.3 and
JSP 1.2


Thanks
Padma
Geetu Bahl
Greenhorn

Joined: Dec 01, 2004
Posts: 14
Thanks for the reply

Paul , isn't EL enabled by default and moreover i checked in web.xml and there is no <el-ignored> tag there, so i guess that it is enabled.

Padma, i am using the same tag library link as you used
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

I am working on websphere 5.0 , is there anything different in that.

Please reply ???
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Paul , isn't EL enabled by default and moreover i checked in web.xml and there is no <el-ignored> tag there, so i guess that it is enabled.

Yep, EL is enabled by default. I am not sure if the jstl include is different in websphere...
M. Gagnon
Ranch Hand

Joined: Feb 18, 2004
Posts: 68
I think Padma is onto something. I remember trying the EL in my JSPs on my machine at home where it worked with no problem. Then I uploaded everything to my live site only to discover that my hosting service was still using JSP 1.2 and Servlets 2.3. If memory serves, the EL expressions were rendered literally.
Padma Lalwani
Ranch Hand

Joined: Nov 02, 2004
Posts: 49
Hi,
In case you are using ${movie} directly in your jsp, try putting it in c out tag. As EL in JSTL is supported by the older specs too.
Thanks
Padma
Joseph Hatton
Greenhorn

Joined: Dec 12, 2002
Posts: 20
Geetu,

I ran into this exact problem in my project. The key is whether you are using JSTL 1.0 or JSTL1.1. JSTL 1.0 demands that you s <c ut value"">, while JSTL 1.1 uses the direct approach of ${}. AND the most important thing is know which version of servlet your serer is using(2.3 or 2.4). I noticed that JSTL1.0 supports Servlet 2.3 and JSTL1.1 support 2.4. So, proper adjustments need to be made in your web.xml file to reflect these changes.

JSTL1.0
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">


JSTL1.1
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" version="2.4">
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL core library tag