8. Introduction::HelloWorld, Model public class HelloWorld { private String message = "Hello World. Time is: " ; public String execute () { message += new Date(); return "success" ; } public String getMessage() { return message ; } } action method returns a result code We don’t have to extend Action Boss … and no request, response in execute() Boss
9.
10.
11.
12. Background ::S2 Vs. S1 Configuration Lifecycle Validation EL View binding Form binding Threading Servlet API Action Role Action Wildcards, annotations Independent via interceptors xml or annotations OGNL Value Stack Action JavaBean properties Instance per request Decoupled Model POJO (with execute) Struts2 Verbose Shared Action Form JSTL EL JSP mechanisms Action Form Single instance Dependant Controller Extends Action Struts1
21. Features ::Action Configuration < action name= "listEmployees" class= "actions.model.Employee" method= "list" > < result name= "list" type= "dispatcher" >/WEB-INF/list.jsp</ result > </ action > result type the view technology (default value: “dispatcher” for rendering JSP) result name action method should return a matching result code string (default value: “success”) action method within action class (default value: “execute”) action class action name matched by a URL