ahhh i was not 'thrwoing' e after catching it >_<

thansk

On Fri, Jul 31, 2009 at 6:55 AM, Bhaarat Sharma <bhaara...@gmail.com> wrote:

> ....but if i am catching it, it is not showing my the common error page i
> made..
>
>
> On Fri, Jul 31, 2009 at 4:29 AM, <mailtolouis2020-str...@yahoo.com> wrote:
>
>> I think you can catch it, then do log.error(e.getMessage(),e); and then
>> throw e;
>>
>>
>>
>> ________________________________
>> From: Bhaarat Sharma <bhaara...@gmail.com>
>> To: Struts Users Mailing List <user@struts.apache.org>
>> Sent: Friday, July 31, 2009 5:03:34 AM
>> Subject: Re: common error page in struts2 application
>>
>> 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