File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring 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?)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get Arraylist in jsp page to render