This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes How to get Arraylist in jsp page to render Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to get Arraylist in jsp page to render" Watch "How to get Arraylist in jsp page to render" New topic
Author

How to get Arraylist in jsp page to render

jaan bhavsar
Ranch Hand

Joined: Aug 23, 2008
Posts: 32
Hi to All,
I am trying to make sample application and cant pass arraylist object on jsp page.
Could any body please guide me regarding to that?

Which will populate my arraylist(emplist) in ListDb class.
I call this method from ListAction.
//code for ListAction

How can i put Arraylist emp in request,and get arraylist object on Jsp page?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Provide a public getter for the list and it's available in the JSP.

Note that you're creating a new ArrayList then promptly replacing it with another one--you might as well skip the unused constructor call.

I'd also consider doing something different than instantiating the ListDB() directly, although it may not be very important yet--it can impede testability and flexibility, though.

(And is an empty list actually an error? It might be--but if not, maybe a different result name would express intent better?)
 
 
subject: How to get Arraylist in jsp page to render
 
Similar Threads
Shopping cart help
Not able to iterate through a bean property of type Array List
Query in Java
RowMapper callback interface's mapRow can pull only one row?
Problem with html:select