I have the code below. When processing the page, the forEach seems to be working since I get the correct number of option items. But, the value of ${min} is displayed literally (the value and display of the option tag is the literal string "${min}"). I want it to show the value of min. What am I doing wrong?
<c:forEach var="min" begin="120" end="1440" step="15">
<option value="<c:out value='${min}' />"><c:out value="${min}" /></option>
</c:forEach>
-
c:forEach (6 messages)
- Posted by: M J
- Posted on: February 25 2005 14:01 EST
Threaded Messages (6)
- jstl i assume by joseph yi on February 25 2005 18:46 EST
- Still having issues by M J on February 28 2005 09:41 EST
-
Still having issues by M J on February 28 2005 01:26 EST
- Runs fine for me by Sairam Ramachandran on February 28 2005 03:08 EST
-
Still having issues by vivek deveshwar on August 10 2005 05:14 EDT
- Re: Still having issues by Anoop Govind on October 11 2008 05:08 EDT
-
Still having issues by M J on February 28 2005 01:26 EST
- Still having issues by M J on February 28 2005 09:41 EST
-
jstl i assume[ Go to top ]
- Posted by: joseph yi
- Posted on: February 25 2005 18:46 EST
- in response to M J
What's the servlet/jsp versions of the container you're running on. If you downloaded the latest JSTL libraries, be sure you're using the 2.4 schema definition in web.xml and not the 2.3 or earlier DTD definition. This only applies if you're using servlet 2.4
If you're running on an earlier container, download JSTL 1.0 instead.
Schema definition of web.xml:
<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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4"> -
Still having issues[ Go to top ]
- Posted by: M J
- Posted on: February 28 2005 09:41 EST
- in response to joseph yi
Ok, I downloaded JSTL 1.0.6, updated my web xml to referance...
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>
Have a reference at the top of the JSP page to...
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
and the results are still the same: the ${min} isn't being evaluated -
Still having issues[ Go to top ]
- Posted by: M J
- Posted on: February 28 2005 13:26 EST
- in response to M J
Is there maybe a way to do this w/ the struts tags? All I need to do is loop from one value to another with a certain step and output the index value. I realize I could do this w/ scriptlet code, but it just seems silly that it's this difficult w/ the Struts and/or JSTL tags. -
Runs fine for me[ Go to top ]
- Posted by: Sairam Ramachandran
- Posted on: February 28 2005 15:08 EST
- in response to M J
I ran your code snippet in my JSP and it works fine. I suppose your JSTL library is not loaded properly. Try referencing the JAR file in the <taglib-location> of your web dep. descriptor and make sure it is loaded in your web app correctly -
Still having issues[ Go to top ]
- Posted by: vivek deveshwar
- Posted on: August 10 2005 05:14 EDT
- in response to M J
I had the same problem, printing ${item} instead of value of ${item}. It got solved by using 2.4 xsd given below (as mentioned by another respondent):
Btw, my web.xml had reference to doctype of 2.2 DTD before this!!
---------
<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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4"> -
Re: Still having issues[ Go to top ]
- Posted by: Anoop Govind
- Posted on: October 11 2008 05:08 EDT
- in response to vivek deveshwar
Hii U have to use "" instead of ' ' for printing the ${item} "> will work for u. also if u need to display it as a comobo box ( u have used the tag, u have to use the tag also :-) "> should solve ur problem.