动态结果集DynamicResult
struts.xml ${r} UserAction.java package com.bjsxt.struts2.user.action; import com.opensymphony.xwork2.ActionSupport; public class UserAction extends ActionSupport { private int type; private String r; public String getR() { return r; } public void setR(String r) { this.r = r; } public int getType() { return type; } public void setType(int type) { this.type = type; } @Override public String execute() throws Exception { if(type == 1) r="/user_success.jsp"; else if (type == 2) r="/user_error.jsp"; return "success"; } } index.jsp <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <% String context = request.getContextPath(); %> Insert title here 动态结果 一定不要忘了为动态结果的保存值设置set get方法