This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to POST parameters to external app

 
Monty Guppy
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to struts. I have a web application which basically is a redirector to other web apps. Depending upon who the user is and which app he wants to access, I (make databse calls &) generate a list of paramters (key,value) that need to be POSTed to the external app.
I am doing request.setAttribute(key,value) to see these params and then do findForward.
The mapping.findForward("success") launchess the other app but my parameters are not being passed. The Action() in the launched app tries to read the parameters from its ActionForm but finds nothing (I think this is because the 2 applications have different context).
Please let me know if you have an idea to accomplish this POST.
Thanks
 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If context changes then it is not possible to pass the parameters using the standard method of using the findForward. In that case you should try to sendRedirect the response to the new location sending the parameters in the qs.
this has worked for me in the past.
Replace your code like this:
return mapping.findForward("next-location");
with
response.sendRedirect("actual-new-location?param1=val1¶m2=val2");
return null;
Lemme know what you think.
Sahil
 
Monty Guppy
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response.
I think by using redirect, the parameter and values would get exposed in the URL (which in my case is undesirable). Please let me know if my assumption is incorrect.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic