on 08-08-2011 11:50 AM
I have a JSP page that consumes a webservice. The JSP page mostly consist of HTML tags and some java codes (for consuming web service). If my web service fails for some reason, I want the page to still show an page that still works (without the error report). That page will not contain my code for consuming web service. Can I do this using just try catch block?
e.g.
<% try{
//connection to web service
%>
<h1>
<%
String var1 = getMethod("1","1");
out.write(var1); //will output Hello
%>
</h1>
<%
}catch (Exception e){
<h1>Hello</h1> <!--my original html page-->
}
%>
This will not work right? Cause you need to have a pure java code inside try catch block. Is there any other way to catch the web service error and still output my original page? Thanks
Looks like I can somehow catch some errors using try catch. I just need to print all my HTML tags in the try catch. My problem know is I can only catch errors in web service lookup. Still can't catch 500 internal server error (Error compiling) and 500 internal server error (error parsing). Is there a way to catch these errors and print a custom error message?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.