Tuesday 27 December 2011

Exception Mapping Example

Dear All,

Please download the attached files.

1] Copy the .java file into the com.sapient.actions package
2] Copy all the jsp files into WEB-INF/pages
3] Make the entry for below action in the struts.xml

<action name="exceptionDemo" class="com.sapient.actions.ExceptionExampleAction">
            <exception-mapping result="ioEx" exception="java.io.IOException" />
            <exception-mapping result="sqlEx" exception="java.sql.SQLException" />
            <exception-mapping result="uoEx" exception="java.lang.UnsupportedOperationException" />
            <result name="ioEx">/WEB-INF/pages/ioExceptionPage.jsp</result>
            <result name="sqlEx">/WEB-INF/pages/sqlExceptionPage.jsp</result>
            <result name="uoEx">/WEB-INF/pages/uoExceptionPage.jsp</result>
            <result>/WEB-INF/pages/normal.jsp</result>
</action>

Thanks and Regards,
Vivek Mehta

No comments:

Post a Comment