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 forward from Array List to Jsp in Struts 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 forward from Array List to Jsp in Struts" Watch "How to forward from Array List to Jsp in Struts" New topic
Author

How to forward from Array List to Jsp in Struts

p hasini
Ranch Hand

Joined: Oct 24, 2009
Posts: 92
How to forward from Array List to Jsp in Struts ActionServlet class
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
How to forward from Array List to Jsp in Struts ActionServlet class
. What does that mean. Can you post a logical requirement or atleast a detailed problem definition for the same.


- Aditya Webservices Blog
p hasini
Ranch Hand

Joined: Oct 24, 2009
Posts: 92
sorry.My question is wrong.

In Action class, how to forward an ArrayList object to a JSP page using tag libraries.
Generally,in Action class,we create a session object .Then add an object to the session using session.setAttribute().Here i can add the array list object.Then forward the response to the jsp page.

Is there a way to do the same using tag libraires.
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
Ok. You need to understand that the tag libraries will come into picture only once your action has forwarded the control to the JSP. So even if we use tag libraries we MUST set the ArrayList either in the request scope or the session scope in the Action.

Understand this:
store data in calls any tag-libs
request/session if defined
Action -------------------> JSP --------------------> TAG LIB DEF (which will retrieve data from the request/session and process it in whichever form you need it).

So you see you must set the ArrayList in the session/request. The tag lib can help you format the data into whichever format you want (i.e. either a table or some other output mechanism).

However you do have an alternative which is to retrive/create the arraylist in the taglib itself. Then you wont have to actually set the ArrayList in the session.However that is something that is NOT recommended.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to forward from Array List to Jsp in Struts