Struts2----动态结果跳转
struts.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><constant name="struts.devMode" value="true"></constant><package name="user" namespace="/user" extends="struts-default"><action name="user" name="code">package com.pegasus.web;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {private int type;private String r;public int getType() {return type;}public void setType(int type) {this.type = type;}public String getR() {return r;}public void setR(String r) {this.r = r;}public String execute() {System.out.println("type:" + type);//在这里定义要跳转的页面的地址if (type == 1)r = "/user_success.jsp";else if (type == 2)r = "/user_error.jsp";return "success";}}?
?
??
?