hi there, i am using the error-page declarative in web.xml in this way <web-app> <error-page> <error-code>404</erro-code> <location>/examples/jsp/ErrorPage.html</location> </error-page> <servlet> <servlet-name>MyServlet</servlet-name> <servlet-class>/MyServlet</servlet> </servlet> </web-app> i am getting the error on server cmd prompt as "web-app" does not allow "servlet" here .so cud any body tell me what cud be the problem and where i did the mistake .i want to call the ErrorPage.html whenever the 404 (file Not Found) occur . Thanks in advance.
Hi snajay i am using Tomcat 4.0 b6 , i did no tget u properly what do u wanna to say. everything is like that only , i am not satisfy abt the answere. plz clear to me . Thanks in advance ------------------ with warm regards ..gaurav
The DTD describes which elements are required in an xml file. they also show the order the must appear in! < !ELEMENT web-app (icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*) > As you see servlet is before error page so, in your xml all entries for servlet must be before any entry for error page.
------------------ I Hope This Helps Carl Trusiak, SCJP2 [This message has been edited by Carl Trusiak (edited September 09, 2001).]
Hi there thanks carl, its solved my that problem, now i am following that sequence ,the problem is over but still i am not getting the error-page whenever the error occur , cud u tell me where i am burning myself , the problem may be in specifying the location. i have the error page ErrorPage.html in the given dir as examples/jsp/ErrorPage.html and i am specifying in web.xml as <location>/examples/jsp/ErrorPage.html</location> cud u tell me whether i specified it correctly or not , but i am not receiving the error page whenever the error occur and there is no othere error-code code i specified in web.xml, i just specified 404 .plz help me and tell me where i am doing the mistake . thanks in advance
I can only assume from what you have that your webapp is examples. If this is the case, your url to your error page needs to be relative to your webapp. In other words, it doesn't need /examples change this entry to <location/jsp/ErrorPage.html</location> And if my assumptions are correct, this will work.