wood burning stoves 2.0*
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 Spring in Action this week in the Spring 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
 
 
subject: Trying to use the OpenConnection()