struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jignesh(india)" <jigne...@aspl.in>
Subject Re: Struts 2: Unable to catch exceptions via global-exception-mappings
Date Thu, 11 Oct 2007 06:11:23 GMT



mikeh96 wrote:
> 
> I am unable to trap an exception and it's being pushed up until it becomes
> a 500 Servlet Exception.
> Hello,
>     Thanks in advanced.....!
>     Do anyone help me,how can i get exception message,StackTrace into my
> user defined class ?
>     My is looks like this:-
> 
>     <global-results>
>                 <result
> name="Exception">/AMK.fi_view/Exception.jsp</result>
>     </global-results>
> 
>     <global-exception-mappings>
> 		<exception-mapping exception="java.lang.Exception" result="Exception"/>
>     </global-exception-mappings>
>    
>     <action name="loginsubmit" class="fi.amk.action.ExternalLogin">
>          xxx....some action
>     </action>
> 
> Best Regards,
> Jignesh
> 
> 
> 
> 
> Basically, I want to catch the exception if a user mistypes an action name
> 
> I am using struts2 (2.0.9).
> 
> Here's the top of the trace:
> org.apache.velocity.exception.ResourceNotFoundException:
> Unable to find resource '/templates/screens/inddd2ex.vm'
> at
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:458)
> 
> Here's my struts.xml file
> 
> (thanks for helping)
> ----------------------------------------------------------------
> <package name="default" extends="struts-default">
> 
> <interceptors>
> <interceptor-stack name="simpleStack">
> <interceptor-ref name="defaultStack" />
> </interceptor-stack>
> </interceptors>
> 
> 
> <global-results>
> <result name="Exception" type="velocity"
> >/templates/screens/exception.vm</result>
> </global-results>
> 
> <global-exception-mappings>
> <exception-mapping
>    exception="java.lang.Exception"
>    result="Exception"/>
> <exception-mapping
>    exception="org.apache.velocity.exception.ResourceNotFoundException"
>    result="Exception"/>
> <exception-mapping
>    exception="java.lang.Runtime"
>    result="Exception"/>
> </global-exception-mappings>
> 
> 
> <action name="*" class="com.opensymphony.xwork2.ActionSupport">
> <interceptor-ref name="exception" />
> <interceptor-ref name="defaultStack" />
> <result type="velocity">/templates/screens/{1}.vm</result>
> </action>
> 
> </package> 
> ----------------------------------------------------------------------------
> 

-- 
View this message in context: http://www.nabble.com/Struts-2%3A--Unable-to-catch-exceptions-via-global-exception-mappings-tf4545971.html#a13150047
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message