日期:2014-05-18 浏览次数:20625 次
<body>
Result</br>
<a href="struts/user?type=1">动态结果集</a></br>
<br>
</body>
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/struts" extends="struts-default">
<action name="user" class="actionClass.User">
<result>
${pages}
</result>
</action>
</package>
package actionClass;
import com.opensymphony.xwork2.ActionSupport;
public class User extends ActionSupport{
private String pages;
private int type;
public String getPage() {
return pages;
}
public void setPage(String page) {
this.pages = page;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String execute() throws Exception {
if ( type == 1 ) {
pages = "/Success.jsp";
} else {
pages = "/error.jsp";
}
System.out.println(pages);
return SUCCESS;
}
}