
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
<struts> <constant name="struts.devMode" value="true" /> <package name="basic-struts2" extends="struts-default"> <interceptors> <interceptor-stack name="appDefault"> <interceptor-ref name="defaultStack"> <param name="exception.logEnabled">true</param> <param name="exception.logLevel">ERROR</param> </interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="appDefault" /> <global-results> <result name="error">/error.jsp</result> <result name="securityerror">/securityerror.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="com.wijaksana.belajar.struts2.exception.SecurityBreachException" result="securityerror" /> <exception-mapping exception="java.lang.Exception" result="error" /> </global-exception-mappings> <action name="causesecurityexception" class="com.wijaksana.belajar.struts2.action.RegisterAction" method="throwSecurityException"> <result>/register.jsp</result> </action> <action name="causeexception" class="com.wijaksana.belajar.struts2.action.RegisterAction" method="throwException"> <result>/register.jsp</result> </action> <action name="causenullpointerexception" class="com.wijaksana.belajar.struts2.action.RegisterAction" method="throwNullPointerException"> <result>/register.jsp</result> </action> <action name="actionspecificexception" class="com.wijaksana.belajar.struts2.action.RegisterAction" method="throwSecurityException"> <exception-mapping exception="com.wijaksana.belajar.struts2.exception.SecurityBreachException" result="login" /> <result>/register.jsp</result> <result name="login">/login.jsp</result> </action> <action name="index"> <result>/index.jsp</result> </action> <action name=""> <result>/index.jsp</result> </action> <action name="hello" class="com.wijaksana.belajar.struts2.action.HelloWorldAction" method="execute"> <result name="success">/HelloWorld.jsp</result> </action> <action name="register" class="com.wijaksana.belajar.struts2.action.RegisterAction" method="execute"> <result name="success">/thankyou.jsp</result> </action> </package> </struts> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<!DOCTYPE html> <%@ taglib prefix="s" uri="/struts-tags" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %> <html> <head> <meta charset="ISO-8859-1"> <title>Exception Handling - Error</title> </head> <body> <h4>The application has malfunctioned.</h4> <p> Please contact technical support with the following information:</p> <h4>Exception Name: <s:property value="exception"/></h4> <h4>Exception Details: <s:property value="exceptionStack"/></h4> <p><a href="index.jsp">Return to the home page.</a></p> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<!DOCTYPE html> <%@ taglib prefix="s" uri="/struts-tags" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %> <html> <head> <meta charset="ISO-8859-1"> <title>Exception Handling - Login</title> </head> <body> <h1>You Must Login</h1> <p>Please login</p> <p><a href="index.jsp">Return to the home page.</a></p> <hr> <s:debug/> </body> </html> |