This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL core library tag

 
Geetu Bahl
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it actually displaying the following?

${movie}

If so, you may want to check to see if EL is ignored in the DD.
 
Padma Lalwani
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic