File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to pass request Attribute to Action in Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to pass request Attribute to Action in Struts 2" Watch "How to pass request Attribute to Action in Struts 2" New topic
Author

How to pass request Attribute to Action in Struts 2

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi everybody..

How to pass Request Attribute to Action..

I am having problem with it.
can anybody help me please?

Thanks
Raza


Good luck!!
A small leak can sink a Gigantic ship.>
Joe carco
Ranch Hand

Joined: Apr 14, 2009
Posts: 82
its pretty difficult do help you if you dont provide any more information. May tell us exactly what the problem is. Some code from your Action and JSP youre having problems with would be very helpful.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

thanks for reply.

I am having a Jsp where i am getting filtered List of Banks.

and setting that List to request.

AS

request.setAttribute("filterList",bankList);

and redirecting to JSP .

But Again calling the Same Action on different method List to get that List from request but its NUll.


my Action is....





Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

Action mapping is..

Joe carco
Ranch Hand

Joined: Apr 14, 2009
Posts: 82
Somehow I think that that is not the Struts2 way of doing things.


Firstly why are you putting attributes directly into the attibutes map of the ServletRequest?
if you have a field "bankList" with public property accessors you can just say and call it directly from your jsp using struts or jstl tags.

secondly, have you made sure that "bank" really is != null ? is the method filter being called correctly?

In what way are you accessing bankList from your jsp?

In Struts2 under "normal" circumstances its not necessary to do "low-level" operations like putting attributes / parameters into the ServletRequest. The framework does this for you.

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

thanks..

but in filter method the list i am getting is filtered on some criteria ...and i want the same list on list() method.
as in list() method either All the banks will be called or if there is filtered List on Request , will be called.

Is there any possible solution to get Request Attribute on list() method?

Thanks..
Raza.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass request Attribute to Action in Struts 2