You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andy Engle <st...@andyengle.com> on 2004/09/09 05:36:38 UTC

Gracefully handling invalid paths

Hi all,

I am wondering how I should handle invalid path situations within my
Struts application.  I want to be able to have a "catch-all" page
whenever someone enters an invalid path so that they don't see that
ugly Tomcat 404 page.  How might I go about doing something like that?

Thanks very much.


Andy


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Gracefully handling invalid paths

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Why not make /error_404.jsp pull in a Tile and display it like so:

<%@ taglib uri="struts-tiles" prefix="tiles" %>
<tiles:insert beanName=".errorJSPDefinition" />

If I have the wrong parameter, you can find the other ones here:
http://struts.apache.org/userGuide/struts-tiles.html

Regards,
David

-----Original Message-----
From: Craig Dickson [mailto:cdickson04@aol.com]
Sent: Thursday, September 09, 2004 1:05 PM
To: Struts Users Mailing List
Subject: Re: Gracefully handling invalid paths


This is correct.

However I have never been able to get it to work if the value of the 
location tag pointed to an action. For example:

<error-page>
          <error-code>404</error-code>
          <location>/do/error</location>
</error-page>

If anyone knows how to make this work properly then I would love to hear 
about it. My particular problem (posted previously without any 
resolution) was that when redirecting an error to the Action, there 
seemed to be different classpath in effect and either the action could 
not be found altogether (even though I could trigger the action directly 
by typing the path to the action in my browser), or if the action was 
found, then none of my resource bundles could be found when rendering 
the page.



Yves Sy wrote on 9/8/2004, 9:15 PM:

 > You can specify it in your web.xml:
 >
 > <error-page>
 >         <error-code>404</error-code>
 >         <location>/error_404.jsp</location>
 > </error-page>
 >
 > -Yves-
 >
 >
 > On Wed, 8 Sep 2004 20:36:38 -0700 (PDT), Andy Engle
 > <st...@andyengle.com> wrote:
 > > Hi all,
 > >
 > > I am wondering how I should handle invalid path situations within my
 > > Struts application.  I want to be able to have a "catch-all" page
 > > whenever someone enters an invalid path so that they don't see that
 > > ugly Tomcat 404 page.  How might I go about doing something like that?
 > >
 > > Thanks very much.
 > >
 > > Andy
 > >
 > > ---------------------------------------------------------------------
 > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
 > > For additional commands, e-mail: user-help@struts.apache.org
 > >
 > >
 >
 >
 >
 > --
 > For me to poop on!
 > http://www.formetopoopon.com
 > http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
 > For additional commands, e-mail: user-help@struts.apache.org
 >



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Gracefully handling invalid paths

Posted by Craig Dickson <cd...@aol.com>.
This is correct.

However I have never been able to get it to work if the value of the 
location tag pointed to an action. For example:

<error-page>
          <error-code>404</error-code>
          <location>/do/error</location>
</error-page>

If anyone knows how to make this work properly then I would love to hear 
about it. My particular problem (posted previously without any 
resolution) was that when redirecting an error to the Action, there 
seemed to be different classpath in effect and either the action could 
not be found altogether (even though I could trigger the action directly 
by typing the path to the action in my browser), or if the action was 
found, then none of my resource bundles could be found when rendering 
the page.



Yves Sy wrote on 9/8/2004, 9:15 PM:

 > You can specify it in your web.xml:
 >
 > <error-page>
 >         <error-code>404</error-code>
 >         <location>/error_404.jsp</location>
 > </error-page>
 >
 > -Yves-
 >
 >
 > On Wed, 8 Sep 2004 20:36:38 -0700 (PDT), Andy Engle
 > <st...@andyengle.com> wrote:
 > > Hi all,
 > >
 > > I am wondering how I should handle invalid path situations within my
 > > Struts application.  I want to be able to have a "catch-all" page
 > > whenever someone enters an invalid path so that they don't see that
 > > ugly Tomcat 404 page.  How might I go about doing something like that?
 > >
 > > Thanks very much.
 > >
 > > Andy
 > >
 > > ---------------------------------------------------------------------
 > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
 > > For additional commands, e-mail: user-help@struts.apache.org
 > >
 > >
 >
 >
 >
 > --
 > For me to poop on!
 > http://www.formetopoopon.com
 > http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
 > For additional commands, e-mail: user-help@struts.apache.org
 >



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Gracefully handling invalid paths

Posted by Yves Sy <yv...@gmail.com>.
You can specify it in your web.xml:

<error-page>
        <error-code>404</error-code>
        <location>/error_404.jsp</location>
</error-page>

-Yves-


On Wed, 8 Sep 2004 20:36:38 -0700 (PDT), Andy Engle
<st...@andyengle.com> wrote:
> Hi all,
> 
> I am wondering how I should handle invalid path situations within my
> Struts application.  I want to be able to have a "catch-all" page
> whenever someone enters an invalid path so that they don't see that
> ugly Tomcat 404 page.  How might I go about doing something like that?
> 
> Thanks very much.
> 
> Andy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



-- 
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org