This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes forwarding to a URL outside of the web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "forwarding to a URL outside of the web application" Watch "forwarding to a URL outside of the web application" New topic
Author

forwarding to a URL outside of the web application

Chris-Huisman
Greenhorn

Joined: Jan 25, 2002
Posts: 23
<p>
I need to pass information to a payment service site in my struts application. To do this i have to link to another site. I would like to do this via my Action by using a forward of some type. Is this possible? Can I do it with a sendRedirect? How do you "link" to a URL in an Action class?
</p>
<p>
The other option is to put the website address in the forms action parameter, ie: <form action="https://paymentsite.html">. Is there a way to use the struts html form taglib to do this?
</p>
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

In Struts 1.1 you can set up an Action forward to go to any URL, not just local ones. All that's really required is that the receiving URL be prepared to understand what you send it.
A JSP can use the <html:link> tag to refer offsite.
Of course, somewhere along the line, you'll need to make sure that the user comes back to you!
For Web Services-type functions, the server might use a URLConnection class in the Action processor if a fast enough response can be assured. The results coming back through the connection can then be used to select the appropriate action to present to the user.


Customer surveys are for companies who didn't pay proper attention to begin with.
Chris-Huisman
Greenhorn

Joined: Jan 25, 2002
Posts: 23
So this would be valid then?
<forward name="payment" path="https://mypayment/service.html"/>
c.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forwarding to a URL outside of the web application