diff --git a/coding-actions/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java b/coding-actions/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java index fdd75f72..88d81d06 100644 --- a/coding-actions/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java +++ b/coding-actions/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java @@ -2,6 +2,7 @@ import org.apache.struts.helloworld.model.MessageStore; import org.apache.struts2.ActionSupport; +import org.apache.struts2.interceptor.parameter.StrutsParameter; /** * Acts as a Struts 2 controller that responds @@ -33,6 +34,7 @@ public String getUserName() { return userName; } + @StrutsParameter public void setUserName(String userName) { this.userName = userName; } diff --git a/coding-actions/src/main/webapp/WEB-INF/web.xml b/coding-actions/src/main/webapp/WEB-INF/web.xml index c698d2bc..03377bb1 100644 --- a/coding-actions/src/main/webapp/WEB-INF/web.xml +++ b/coding-actions/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,8 @@ - + Coding Actions index.jsp diff --git a/exception-handling/pom.xml b/exception-handling/pom.xml index b07f43b5..5333dce1 100644 --- a/exception-handling/pom.xml +++ b/exception-handling/pom.xml @@ -15,6 +15,13 @@ war + + + org.apache.struts + struts2-config-browser-plugin + + + exception-handling diff --git a/exception-handling/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java b/exception-handling/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java index 1547a2ee..eee13a98 100644 --- a/exception-handling/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java +++ b/exception-handling/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java @@ -2,6 +2,7 @@ import org.apache.struts.helloworld.model.MessageStore; import org.apache.struts2.ActionSupport; +import org.apache.struts2.interceptor.parameter.StrutsParameter; /** * Acts as a Struts 2 controller that responds @@ -37,6 +38,7 @@ public String getUserName() { return userName; } + @StrutsParameter public void setUserName(String userName) { this.userName = userName; } diff --git a/exception-handling/src/main/java/org/apache/struts/register/action/Register.java b/exception-handling/src/main/java/org/apache/struts/register/action/Register.java index 80cc8c07..2da01636 100644 --- a/exception-handling/src/main/java/org/apache/struts/register/action/Register.java +++ b/exception-handling/src/main/java/org/apache/struts/register/action/Register.java @@ -3,6 +3,7 @@ import org.apache.struts.register.exceptions.SecurityBreachException; import org.apache.struts.register.model.Person; import org.apache.struts2.ActionSupport; +import org.apache.struts2.interceptor.parameter.StrutsParameter; /** * Acts as a controller to handle actions related to registering a user. @@ -43,6 +44,7 @@ public void throwSecurityException() throws SecurityBreachException { "Security breach exception thrown from throwSecurityException"); } + @StrutsParameter(depth = 1) public Person getPersonBean() { return personBean; diff --git a/exception-handling/src/main/resources/struts.xml b/exception-handling/src/main/resources/struts.xml index fceebbd8..975fe5a5 100644 --- a/exception-handling/src/main/resources/struts.xml +++ b/exception-handling/src/main/resources/struts.xml @@ -69,8 +69,13 @@ /HelloWorld.jsp + + /register.jsp + + - /thankyou.jsp + /thankyou.jsp + /register.jsp diff --git a/exception-handling/src/main/webapp/WEB-INF/web.xml b/exception-handling/src/main/webapp/WEB-INF/web.xml index 58d2ff92..df61ed06 100644 --- a/exception-handling/src/main/webapp/WEB-INF/web.xml +++ b/exception-handling/src/main/webapp/WEB-INF/web.xml @@ -1,11 +1,14 @@ - -Exception Handling - - index.jsp - - - + + + Exception Handling + + index.jsp + + struts2 org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter @@ -15,5 +18,5 @@ struts2 /* - + diff --git a/exception-handling/src/main/webapp/error.jsp b/exception-handling/src/main/webapp/error.jsp index 8fdcfe17..5253216c 100644 --- a/exception-handling/src/main/webapp/error.jsp +++ b/exception-handling/src/main/webapp/error.jsp @@ -17,7 +17,7 @@

Exception Details:

-

Return to the home page.

+

Return to the home page.

diff --git a/exception-handling/src/main/webapp/index.jsp b/exception-handling/src/main/webapp/index.jsp index 44f1fe46..d5f74049 100644 --- a/exception-handling/src/main/webapp/index.jsp +++ b/exception-handling/src/main/webapp/index.jsp @@ -23,7 +23,7 @@ -

Please register for our prize drawing.

+

Please register for our prize drawing.

Cause Exception

Cause Null Pointer Exception

Cause Global Security Exception

diff --git a/exception-handling/src/main/webapp/login.jsp b/exception-handling/src/main/webapp/login.jsp index 37359b44..2186fabf 100644 --- a/exception-handling/src/main/webapp/login.jsp +++ b/exception-handling/src/main/webapp/login.jsp @@ -11,7 +11,7 @@

Please login

-

Return to the home page.

+

Return to the home page.


diff --git a/exception-handling/src/main/webapp/securityerror.jsp b/exception-handling/src/main/webapp/securityerror.jsp index 4eb15228..effcba23 100644 --- a/exception-handling/src/main/webapp/securityerror.jsp +++ b/exception-handling/src/main/webapp/securityerror.jsp @@ -16,6 +16,6 @@

Exception Name:

Exception Details:

-

Return to the home page.

+

Return to the home page.