File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Spring
Author
Not able to pass List values to view
vikas sharmaa
Ranch Hand
Joined: Jun 28, 2007
Posts: 191
posted
Apr 02, 2010 16:17:42
0
i am using Spring 3.0 and not able to pass List to the view. Please look into my code below:
controller class:
@RequestMapping(method = RequestMethod.GET) public String demo(ModelMap model) { List <User>myList = new List<User>(); User user1 = new User(); user1.setUserName("kevin"); User user2 = new User(); user2.setUserName("toby"); myList.add(user1); myList.add(user2); model.addAttribute("myList", myList); }
Here i am creating a simple myList List with 2 Objects of User class.
and, here below is the code in jsp page:
<c:forEach items="${myList}" var="my" varStatus="status"> <td>${my.userName}</td> </c:forEach>
but, i am getting a blank myList. On view source, the following html is generated:
<c:forEach items="" var="my" varStatus="status"> <td></td> </c:forEach>
please tell, where i am going wrong? thank you.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Apr 02, 2010 18:01:49
0
If that's the source then it's not even evaluating the JSTL.
vikas sharmaa
Ranch Hand
Joined: Jun 28, 2007
Posts: 191
posted
Apr 03, 2010 05:38:50
0
thank you newton. i was mistakenly using functions instead of core jstl taglib.
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Not able to pass List values to view
Similar Threads
passing a parameter to an action class
JSTL printing issue
NumberFormatException on using form:radiobuttons
Acess list elements on foreach JSTL tag
One of My Favorite Stripes Features (A Complex Example)
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter