• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to display data from an arraylist of more than one bean on jsp page using scripting or jsp tags?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm creating a project management website and have come across a problem. I can obtain the desired result using a scriptlet in a jsp but I would like to write the code in the servlet(controller). I have an arraylist of projectbeans of which I want to display all the information of when a client clicks on the projects button - i.e. - they will get the project id, date, and name of all the projects they are involved in.

Heres my code for the scriptlet in projects.jsp that works:



However I would like to write it in my projectsServlet and have some el scripting or jsp tags to display the information in my jsps

i.e. ${projectDetails} or jsp:useBean "projectDetails" etc etc

I can do it for one bean in the arraylist but I can not work out how to do it when there is more than one...

here is my lame attempt



and then I was thinking about displaying the project details based on the size of the arraylist but I still come back to my original problem...

In summary how do I display data from more than one bean in an arraylist of beans on my jsp page using scripting or jsp tags? I fear this is very simple but it has stumped me.

Thanks James
 
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
JSTL's <c:forEach>
 
James Haville
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep all done. Thanks for your help...

My new code:
 
David Newton
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
Glad you got it working :)
 
Ranch Hand
Posts: 282
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like your bean has a Date object. You can use the <fmt:formatDate> JSTL tag to format Dates.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic