0

I want to make a POST HTTP request from a struts2 action to an external URL and send parameters in the request.

I have read that it can be done in this way: External django redirect with POST parameters but I was wondering if it can be done in a different way, let's say, directly from the action and not throgh a JSP.

Thanks for any suggestions.

Community
  • 1
  • 1
jddsantaella
  • 3,657
  • 1
  • 23
  • 39

1 Answers1

0

It depends on what you're actually trying to do.

If you're trying to make a request from your action to another site, then do something with the response and return data to the user without the user knowing the external site was accessed, then you'd need to use something like Apache's HttpClient. That can be done anywhere, bt obviously doesn't belong in a JSP as you state.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • Thanks for your answer. The external application will process the request and it will display a form to the user (user interaction is needed) so the URL of this external Web will be displayed. – jddsantaella Oct 05 '11 at 14:18
  • Then you'd need to POST an actual form, although it can be created as hidden and submitted via JavaScript (as suggested on the other page). You can't do a sendRedirect as a POST AFAIK. – Dave Newton Oct 05 '11 at 14:23