读书人

Struts2.x快速下手2-改进Controller A

发布时间: 2012-11-10 10:48:50 作者: rapoo

Struts2.x快速上手2--改进Controller Action

改进Controller Action

?

方法一:
implements Action(Interface of xwork)


1)Login.jsp---->Logon.jsp(重新提供)
?<form action="Logon.action" method="post">


2)public class LogonAction implements Action
?execute() {
??...
??return this.SUCCESS;
??return this.ERROR;
?}

注释:阅读Action接口的源码

?

方法二:

extends ActionSupport(com.opensymphony.xwork2.ActionSupport)


1)Login.jsp---->Logon.jsp(重新提供)
?<form action="Logon.action" method="post">


2)public class LogonAction implements Action
?execute() {
??...
??return this.SUCCESS;
??return this.ERROR;
?}

注释:阅读ActionSupport的源码

读书人网 >软件架构设计

热点推荐