I've written a web app that has a servlet that reads from a database a list of names and corresponding pager numbers, and forwards to a JSP that calls a custom tag to build an XML style JSP from the ResultSet (saved in the session), and includes that JSP in a frame on the calling JSP. Someone can then select a name, type in a message, and click submit, which sends a page to that person. The paging mechanism is done via Verizon Wireless's webpage www.myairmail.com (my company has a contract with them). When the user clicks submit, it forwards the request to this website (via action=""). However, a confirmation page from Verizon is then displayed in this frame, which I'd like to instead put a personalized confirmation page. Is there a way to forward from a servlet to an outside URL, or am I pretty much stuck with what I've got? Thanks Jason
You may also find some tag libraries provide the functionality you're looking for. Check out the Jakarta Standard taglibs project, specifically the IO taglibor the Scrape taglib Both encapsulate a call to another URL outside the web application quite nicely. HTH, Chris
I don't think you are trying to forward - that would imply that the user is leaving your website. What you are actually trying to do is invoke someone else's webapp as a subroutine of your own web logic. As Junilu said, the servlet can use HttpURLConnection for that, just like applets do (except that you don't have the "sandbox" restriction that applets have). The only special considerations would be to allow for the extra time it takes to do a request to someone else's network (user's browser could time out) - and, of course, the fact that the external server might sometimes return an unexpected response.
An IDE is no substitute for an Intelligent Developer.
Chicken Farmer ()
Joined: May 08, 2001
What you said is right Tim, they have a CGI script that runs on the request, that's mainly what I was trying to get. But I've decided to go another route. Since this webapp ties in with a bigger application that listens to a database for updates, I still have to come up with a way for that listener to page people when an event occurs. So I decided to dig into the javax.comm API and go that route instead, avoiding the whole Verizon webpage thing. Thanks for the info and the links though, will come in very handy when I start learning the net API's.