读书人

大局结果集

发布时间: 2012-08-24 10:00:21 作者: rapoo

全局结果集
全局结果集(Global_Result):
<global-results> <!-- 全局result,在package中可以共用的结果集 -->
<result name="mainpage">/Hello.jsp</result>
</global-results>

//actionpackage com.bjsxt.struts2.user.action;import com.opensymphony.xwork2.ActionSupport;@SuppressWarnings("serial")public class UserAction extends ActionSupport {private int type;public int getType() {return type;}public void setType(int type) {this.type = type;}@Overridepublic String execute() throws Exception {if (type == 1)return "success";else if (type == 2)return "error";elsereturn "mainpage";}}package com.bjsxt.struts2.user.action;import com.opensymphony.xwork2.ActionSupport;@SuppressWarnings("serial")public class AdminAction extends ActionSupport {@Overridepublic String execute() throws Exception {return "mainpage";}}

读书人网 >软件架构设计

热点推荐