This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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