• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error-page declaration in web.xml

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


------------------
with warm regards
..gaurav
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hallo,
if you are using tomcat 3.X, then
try using 2.3 spec.I mean
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

Gruss
sanjay

 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

------------------
with warm regards
..gaurav
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

------------------
I Hope This Helps
Carl Trusiak, SCJP2
 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There,
Thanks a lot Carl , now its working fine and ur asumption was absoultely correct .

------------------
with warm regards
..gaurav
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic