aspose file tools*
The moose likes Struts and the fly likes why i cannot get request object in Action class from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "why i cannot get request object in Action class from jsp" Watch "why i cannot get request object in Action class from jsp" New topic
Author

why i cannot get request object in Action class from jsp

Kaleeswaran Karuppasamy
Ranch Hand

Joined: Jul 19, 2007
Posts: 154
i cannot get request object in action class in struts.i set arraylist value in request Object(request.setAttribute()),howerver i connot get request object in DispatchAction class using request.getAttribute(). please tell is there any other way to get ArrayList Object from jsp page to Action class excluding session Object.



Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can't pass data from a JSP to an action by using request.setAttribute in the JSP. The reason for this is that the when the JSP is rendered and the resultant HTML sent back to the browser, the request is then out of scope. When the Action is called, you have an entirely new instance of HTTPServletRequest, and the old one is no longer accessible.

If you want to pass data from the JSP to the Action, the best way to do so is by setting form input fields to some value. If you want to pass a value that is not displayed, use a hidden field (html:hidden tag).


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why i cannot get request object in Action class from jsp