This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
<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>
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.
An IDE is no substitute for an Intelligent Developer.
Joined: Jan 25, 2002
So this would be valid then? <forward name="payment" path="https://mypayment/service.html"/> c.