File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Trying to use the OpenConnection() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trying to use the OpenConnection()" Watch "Trying to use the OpenConnection()" New topic
Author

Trying to use the OpenConnection()

von rodrig
Greenhorn

Joined: Jun 28, 2002
Posts: 2
I am trying to write a servlet that will check to see if an url exist and if exist display the page if it does not exist display an error message. Also, if the page give a 404 error code they need to be redirected. How do I do this? Need help!!!
Bonnie Beach-Morin
Greenhorn

Joined: Jun 13, 2002
Posts: 13
Use an HttpURLConnection and call the getResponseCode().
You can do something like this:


SJCP2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trying to use the OpenConnection()
 
Similar Threads
JSF : redirect errors to error page
How to avoid using session scope in this case?
importing error in JSP
displaytag library, add/append parameters (from Httpsession) to Page number links
JSP HTTP Status 404 The requested resource (/*.jsp) is not available