response.sendRedirect - check redirect is up
- by Trick
From JSP I just want a redirect to another page...
<% response.sendRedirect("http://www.google.com/"); %>
Can I check if google.com is up and then redirect (or write a msg else)...
Something like that:
<% if(ping("www.google.com")) {
response.sendRedirect("http://www.google.com/");
} else {
// write a message
}%>
Or
<% try {
response.sendRedirect("http://www.google.com/");
} catch(SomeException e) {
// write a message
}%>
It is just an JSP page, I don't have any libraires available (like ApacheCommons for http GET methods).