Sorry I am a little confused.  Basically I need to be able to log the
message by doing log.error(e.getMessage(), e);  However, if i catch the
error and put it in the catch block then the global error page does not come
up (I am assuming because the exception is caught?)

If I do not catch the exception, then the error page shows up, however, I
have no way to do log.error(e.getMessage(), e);

After reading,
http://struts.apache.org/2.0.6/docs/exception-configuration.html I though I
can have a chainAction so something like.
<package...>
        <global-results>
               <result name="Exception" type="chain">
                  <param name="actionName">ErrorPage</param>
                 <param name="namespace">/error</param>
               </result>
        </global-results>

        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception"
result="Exception"/>
        </global-exception-mappings>
        <action name="selectionPage" class="reports.ReportSelection">
            <result>/reports/SelectionPage.jsp</result>
        </action>

</package>
<package name="secure"  namespace="/error">
    <action name="ErrorPage" class="com.myErrorClass">
        <result>errorpage.jsp</result>
    </action>
</package>
So finally, if i do not catch the error, the control will go to
com.myErrorClass.  Will I be able to do log.error(e.getMessage(), e); in
that class?? I dont think it will be available as originally the error was
thrown in reports.ReportSelection class.

I'd appreciate any help to guide me in right direction.

Thanks

On Thu, Jul 30, 2009 at 11:40 PM, Bhaarat Sharma <bhaara...@gmail.com>wrote:

> will the global exception not recognize the exception if I am catching it??
> I need to catch it because I want to put it in the logs.  However, in my
> example, if i am catching the exception then I am seeing that the error page
> defined with global-results is not coming up.
> do the global exception mappings only work for 'non caught' exceptions?
>
>
> On Thu, Jul 30, 2009 at 4:07 PM, Dave Newton <newton.d...@yahoo.com>wrote:
>
>> Bhaarat Sharma wrote:
>>
>>> Is there a way to just add [exception mapping] somewhere so that all
>>> 20 package mappings see it?
>>>
>>> most of the packing are using struts-default
>>>
>>
>> You could create your own base package and extend from that. Package
>> extension is also documented on the Struts 2 wiki (briefly):
>>
>> http://struts.apache.org/2.1.6/docs/package-configuration.html
>>
>>
>> Dave
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>

Reply via email to