Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Missing request parameters after servlet chaining

 
steward frank
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");


 
steward frank
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic