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 POST parameters to external app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to POST parameters to external app" Watch "How to POST parameters to external app" New topic
Author

How to POST parameters to external app

Monty Guppy
Ranch Hand

Joined: Sep 15, 2001
Posts: 49
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

Joined: Jan 30, 2001
Posts: 228
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


Adios
Monty Guppy
Ranch Hand

Joined: Sep 15, 2001
Posts: 49
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to POST parameters to external app
 
Similar Threads
struts action messages - placeholder replacement
Java GUI Testing Framework/Integration
Understanding threads better?
Maintaining state between two web services
Audit Trail for Web Application