VolSpeak
asked on
jsp error report
Is there any way I can check for the error below before the error is displayed and redirect to a different page if it will be displayed.
HTTP Status 404 - //main//file.doc
type Status report
message //main//file.doc
description The requested resource (//main//file.doc) is not available.
Apache Tomcat/4.1.29
HTTP Status 404 - //main//file.doc
type Status report
message //main//file.doc
description The requested resource (//main//file.doc) is not available.
Apache Tomcat/4.1.29
ASKER
I dont think thats what im looking for.
>>description The requested resource (//main//file.doc) is not available.
This is a specific error to my web app , if this error is thrown the file has been deleted, i want to inform the user of this
>>description The requested resource (//main//file.doc) is not available.
This is a specific error to my web app , if this error is thrown the file has been deleted, i want to inform the user of this
why don't you use a try catch then
<%
try{
code that might throw the error
}
catch(Exception e){
%>
<jsp:forward page="myErrorPage.jsp" />
<%
}
in myErrorPage.jsp
you can have some lines of code to explain what happened.
Cheers,
Ghost
%>
<%
try{
code that might throw the error
}
catch(Exception e){
%>
<jsp:forward page="myErrorPage.jsp" />
<%
}
in myErrorPage.jsp
you can have some lines of code to explain what happened.
Cheers,
Ghost
%>
I believe this is what you are looking for:
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=56&t=000330
Basically, you have add something like this in your web.xml:
<error-page>
<error-code>404</error-cod e>
<location>/notFound.jsp</l ocation>
</error-page>
-Mark
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=56&t=000330
Basically, you have add something like this in your web.xml:
<error-page>
<error-code>404</error-cod
<location>/notFound.jsp</l
</error-page>
-Mark
ASKER
Im using the filename as a href so that wont work in my sisuations
use my suggestion it will work
Ghost
Ghost
ASKER
Mark: that would work for me, can I put that code anywhere in my web.xml?
ASKER
copyPasteGhost: I would have to embed your code in an xsl stylesheet and i dont think jsp can be embedded in xsl.
??? xsl?
why did you post your question in the jsp section?
wouldn't the xml section have been better?
your error said you were using tomcat's server? if your not using jsp how is that possible?
Ghost
why did you post your question in the jsp section?
wouldn't the xml section have been better?
your error said you were using tomcat's server? if your not using jsp how is that possible?
Ghost
ASKER
im using a stylesheet against a file and if its not found the error is displayed. I am using jsp with xsl.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The actual page the error is thrown on doesnt exist on my machine. Ideally I could do a check against the page and to see if it exists.
ASKER
Ive amended my web.xml as shown but its not linking to my page of choice.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
-
<html>
<body/>
</html>
Do I have to specify the location somewhere else?
ASKER
>>This XML file does not appear to have any style information associated with it. The document tree is shown below.
-
<html>
<body/>
</html>
This is the error page it link to
ASKER
I got it :)
what was it?
Yes:
<location>/notFound.jsp</l ocation>
I believe you should place the 'notFound.jsp' in this directory:
../yourwebapp/
not ../yourwebapp/WEB-INF/
-Mark
<location>/notFound.jsp</l
I believe you should place the 'notFound.jsp' in this directory:
../yourwebapp/
not ../yourwebapp/WEB-INF/
-Mark
Oh.. Ok. Good!
ASKER
>> what was it?
What Mark posted
Ghost