You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Givler, Eric" <eg...@state.pa.us> on 2008/02/21 20:38:23 UTC

[S1] Global Exception from Module can't find resource

Greetings....

I have an application split into three modules.  When an application
error occurs, I have a global exception defined in the root
configuration, as well as in each module.  

When the module hits the error, the global exception's entry in the
module is:

        <exception type="view.exception.ApplicationUnavailableException"
                   handler="view.struts.exception.MyExceptionHandler"
 
path="/SwitchModule.do?prefix=&amp;page=/AppOffline.do"
                   key="exception.applicationunavailableexception"
                   scope="request">

The root module's exception handler is mapped as follows and the
corresponding action:

        <exception type="view.exception.ApplicationUnavailableException"
                   handler="view.struts.exception.MyExceptionHandler"
                   path="/AppOffline.do"
                   key="exception.applicationunavailableexception"
                   scope="request">

       <action path="/AppOffline"
               forward="/AppOffline.jsp" />


The problem is that when it goes there when an error occurs in the
module, the forward still displays the module path, and then the JSP
can't find the stylesheet referenced in the link tag.  The link tag
looks like this in files within the module:

<LINK REL="stylesheet" TYPE="text/css" HREF="../css/MyStyle.css"/>

In the AppOffline.jsp the link tag is as follows, since the css is off
the context root, but the Address bar shows we're not there (we still
have the module prefix):

<LINK REL="stylesheet" TYPE="text/css" HREF="css/MyStyle.css"/>

What needs to be done to fix this?  

It seems like it should either be:
A) Somehow get the exception to redirect to the AppOffline. How?
B) change the link tag so it always reads from the Context Root.

I've had similar problems with going from the root module to another
module in that the URL has not changed (due to a forward) and the css
file cannot be found since it was reading ../css/File.  I wanted the
user to click a button to go from one screen into the application (they
had to agree to a message).  A hyperlink worked fine, but the agreement
was in module1 prior to forwarding to module2.

Anyway, that's enough rambling.  If you can share some ideas/thoughts,
I'd really appreciate it.

Thanks,

Eric

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


Re: [S1] Global Exception from Module can't find resource

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/21, Givler, Eric <eg...@state.pa.us>:
>  B) change the link tag so it always reads from the Context Root.

Just a quick help: use <c:url> tag, that will transform your relative
path to a server-relative URL:
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/c/url.html

HTH
Antonio

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