aspose file tools
The moose likes Servlets and the fly likes How to display data from an arraylist of more than one bean on jsp page using scripting or jsp tags? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to display data from an arraylist of more than one bean on jsp page using scripting or jsp tags?" Watch "How to display data from an arraylist of more than one bean on jsp page using scripting or jsp tags?" New topic
Author

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

James Haville
Greenhorn

Joined: Jul 19, 2010
Posts: 10
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
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

JSTL's <c:forEach>
James Haville
Greenhorn

Joined: Jul 19, 2010
Posts: 10
Yep all done. Thanks for your help...

My new code:
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Glad you got it working :)
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 272

It looks like your bean has a Date object. You can use the <fmt:formatDate> JSTL tag to format Dates.


SCJP 6 || SCWCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display data from an arraylist of more than one bean on jsp page using scripting or jsp tags?
 
Similar Threads
Type safety: Unchecked cast from Object to ArrayList
Online Shopping
Struts 2: tree tag causing javascript errors
Unable to retrieve value in JSP
Avoid Cross site scripting in Jsp