File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trying to use the OpenConnection()" Watch "Trying to use the OpenConnection()" New topic

Trying to use the OpenConnection()

von rodrig

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

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

I agree. Here's the link:
subject: Trying to use the OpenConnection()
It's not a secret anymore!