Struts2 Action????????
???????????? ???????[ 2013/9/18 13:34:31 ] ????????
??????????struts.xml????????????????壺
<package name="testit" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="testInterceptor" class="interceptor.MyInterceptor"/>
</interceptors>
<action name="createaccount" class="action.AccountAction">
<result name="success">/index.jsp</result>
<result name="input">/createaccount.jsp</result>
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="testInterceptor"/>
</action>
</package>
???????У?????????????
????before processing
????bye bye execute
????????struts???а????????????????jar??????????????plugin.jar??β??????????????struts2-spring-plugin-2.2.1.1.jar????????????????????????????????????2?????????С????spring-beans-2.5.6.jar??spring-context-2.5.6.jar?????????????????????ν????StrutsSpringTestCase????????????web.xml??????????????????????????????????
????2.StrutsSpringTestCase
???????????????????????????????????
????MathAction.java
package action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import service.MathService;
public class MathAction extends ActionSupport{
private MathService service;
public String execute() throws Exception {
ServletActionContext.getRequest().setAttribute("add.result"??service.add(1??2));
return SUCCESS;
}
public MathService getService() {
return service;
}
public void setService(MathService service) {
this.service = service;
}
}
????MathService.java
package service;
public class MathService {
public int add(int a??int b){
return a+b;
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11