You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Segall <da...@segall.net> on 2007/12/27 15:40:23 UTC
Tomcat JSF custom error page
I have, after hours of trial and error, managed to persuade Tomcat to
use my custom error page in a Java Server Faces application. Now that I
have solved the problem I would like to know where I could have looked
to find the answer.
In case someone finds this page via a web search I should provide the
answer here. I had to add the following lines to
%CATALINA_HOME%\webapps\MyApp\WEB-INF\web.xml
<error-page>
<error-code>404</error-code>
<location>/faces/pagenotfound.jsp</location>
</error-page>
The initial "/" was required in the location despite the fact that the
NetBeans Visual Web Pack generated <welcome-file> tag did not have a
leading "/". Would I have solved this problem more quickly if I was not
using NetBeans as a "rapid application development" tool?
--
David
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat JSF custom error page
Posted by Louis <la...@gmail.com>.
David Segall wrote:
> I have, after hours of trial and error, managed to persuade Tomcat to
> use my custom error page in a Java Server Faces application. Now that
> I have solved the problem I would like to know where I could have
> looked to find the answer.
>
> In case someone finds this page via a web search I should provide the
> answer here. I had to add the following lines to
> %CATALINA_HOME%\webapps\MyApp\WEB-INF\web.xml
>
> <error-page>
> <error-code>404</error-code>
> <location>/faces/pagenotfound.jsp</location>
> </error-page>
>
> The initial "/" was required in the location despite the fact that the
> NetBeans Visual Web Pack generated <welcome-file> tag did not have a
> leading "/". Would I have solved this problem more quickly if I was
> not using NetBeans as a "rapid application development" tool?
The j2ee specification or web.xml dtd or xsd would have told you that
information. This doesn't really have anything to do with JSF specifically.
> The initial "/"
Yeah they could have been a little more consistent.
Would you have solved the problem more quickly? Not likely. Netbeans
isn't a RAD tool. It's an IDE (integrated development environment). RAD
is more a way of working rather than the tools you're using. At least
initially you're better off using one IDE consistently rather than
jumping ships everytime you have a problem. Once you get comfortable
developing in one, then I would recommend you try two or more other
IDE's to see how they do things differently. And flat out learn how to
do what you're doing with a plain text editor. You'll understand what's
actually going on in the IDE better.
Further Reading:
http://java.sun.com/dtd/web-app_2_3.dtd
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
This documents well (in english) what each of the elements in the
web.xml are for.
http://e-docs.bea.com/wls/docs61/webapp/web_xml.html
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org