• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL's <c:forEach>
 
James Haville
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep all done. Thanks for your help...

My new code:
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you got it working :)
 
Ranch Hand
Posts: 281
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!