aspose file tools
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
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply 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: 31
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?)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to get Arraylist in jsp page to render
 
Similar Threads
Not able to iterate through a bean property of type Array List
RowMapper callback interface's mapRow can pull only one row?
Shopping cart help
Query in Java
Problem with html:select