• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How to get Arraylist in jsp page to render

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic