• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

tag error-page web.xml

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I would like that my <error-page> was a Servlet, but don't work with Tomcat 4.1
I have a web deployment file with this:
<servlet>
<servlet-name>ErrorPageServlet</servlet-name>
<servlet-class>ErrorPageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ErrorPageServlet</servlet-name>
<url-pattern>/Error</url-pattern>
</servlet-mapping>

<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/Error</location>
</error-page>
If i enter on browser : http://localhost:8080/cert/Error this work fine.
But if occur any Exception, the page that is show is a default error page of Tomcat.
If i change a location for a jsp page work fine too.
How to work with servlet not .jsp?
Thanks
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try to set in your <location> a direct root related path to your error-servlet, not a mapped url-pattern.
does it help?
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Asher,
But this don't function too...
I will go try others possibilities.
Best Regards,
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmm. did you type the full version of your web.xml file? may be there is a tags' order problem in your web deployment descriptor?
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Follow the web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Teste</servlet-name>
<servlet-class>Teste</servlet-class>
</servlet>
<servlet>
<servlet-name>setStatusCode</servlet-name>
<servlet-class>SetStatusCodeServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>sendErrorServlet</servlet-name>
<servlet-class>SendErrorServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>SomaValores</servlet-name>
<servlet-class>SomaValores</servlet-class>
</servlet>
<servlet>
<servlet-name>ErrorPageServlet</servlet-name>
<servlet-class>ErrorPageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ErrorPageServlet</servlet-name>
<url-pattern>/Erro</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
<location>/jsp/erro.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/cert/servlet/ErrorPageServlet</location>
</error-page>
</web-app>
Thanks
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in <servlet> you write
<servlet-class>ErrorPageServlet</servlet-class>
but in <error-page> you have
<location>/cert/servlet/ErrorPageServlet</location>
the location of ErrorPageServlet in these cases is not the same.
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Asher,
Best Regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic