This week's book giveaway is in the
General Computing
forum.
We're giving away four copies of
Arduino in Action
and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
JSP
Author
Problem with JSTL
Bharadwaj Adepu
Ranch Hand
Joined: Dec 30, 2007
Posts: 99
posted
Sep 06, 2008 04:08:00
0
if(request.getAttribute("releaseLst") != null) pageContext.setAttribute("releaseLst",request.getAttribute("releaseLst")); ........ <c:forEach var="str" items="${fruitsLst}"><option value="<c:out value="${str}"/>"> <c:out value="${str}"/> </option> </c:forEach>
This is piece of code that gives a list of fruit names in a drop down.
When i iterate and print this list in the bean this gives
Apple Orange Banana Mango
But the output of the
JSP
prints this in the dropdown
[Apple Orange Banana Mango]
Why is this list returning in square brackets and a space before each fruit name?
SCJP 1.5
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56540
14
I like...
posted
Sep 06, 2008 10:04:00
0
First, a few questions about your code:
if(request.getAttribute("releaseLst") != null) pageContext.setAttribute("releaseLst",request.getAttribute("releaseLst")); ........ <c:forEach var="str" items="${fruitsLst}"><option value="<c:out value="${str}"/>"> <c:out value="${str}"/> </option> </c:forEach>
Is it really formated like that? Do you find it easily readable?
Why is there Java code in your JSP? if you are using JSTL an EL, there should be no Java code in your JSP.
Why are you copying the attribute from request scope to page scope? What is the purpose?
Why is this list returning in square brackets and a space before each fruit name?
What is the nature of the data in fruitsLst?
And what happened to the "i" in fruitsL
i
st?
[ September 06, 2008: Message edited by: Bear Bibeault ]
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Problem with JSTL
Similar Threads
option tag problem
Drag and drop in Listbox
same key for diff values in HashMap
<s:property value=""> in comparison
Iterating through local List using JSTL
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter