Two Laptop Bag*
The moose likes Struts and the fly likes Missing request parameters after servlet chaining Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Missing request parameters after servlet chaining" Watch "Missing request parameters after servlet chaining" New topic
Author

Missing request parameters after servlet chaining

steward frank
Greenhorn

Joined: Mar 22, 2004
Posts: 20
Hi there,
I am currently using struts and am using action chaining, however i realize that when a request comes in with parameters , the corrresponding action class gets activated and then it forwards to another action class , then that action class forwards to a jsp page, now the thing is when it reaches the jsp page, the request parameters mysteriously goes missing, i got a null, but i am able to retrieve those parameters in the first action class. am i missing something here? or is this an inherent problem in struts? is so, how do i work around it? putting the request parameters as attributes seem like an ugly workaround, can someone enlighten me? Thanks!!


Best Regards
John Carnell
Author
Ranch Hand

Joined: Sep 27, 2002
Posts: 71
Hi Steward,

How are you "forwarding" the request? In the action class are you forwarding to the next action by using actionMapping.findForward(...) in the execute() method of the Action class you are forwarding from.

Thanks,
John


John Carnell<br />Principal Architect<br /> <br />Netchange, LLC<br />1161 HillCrest Heights<br />Green Bay, WI 54313<br /> <br />john.carnell@netchange.us<br /> <br /> <br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/159059228X/ref=jranch-20" target="_blank" rel="nofollow">Pro Jakarta Struts, Second Edition</a>
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
In action ,
class you can keep your request parameter with request/session/application like this:

request.setAttribute("some parameter", request.getParameter("some parameter"));

or

request.getSession().setAttribute("some parameter", request.getParameter("some parameter"));


And in jsp page

you can get data in request/session like this :

request.getAttribute("some parameter");

or

session.getAttribute("some parameter");




SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
steward frank
Greenhorn

Joined: Mar 22, 2004
Posts: 20
Hello John Carnell,
Yes, thats what i am doing, hey!, how do you know? oh yeah of course you do , you wrote the book!! hehe, so is this a known issue? how can i solve this problem? Many thanks!!!

Best Regards
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Missing request parameters after servlet chaining