MyAction.java
package com.zzn.action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.opensymphony.xwork2.ActionSupport;
@Results(
{
@Result(name="aaaa",location="aaaa!aaaa.action",type="redirect",
params = {"flag","${flag}","flag2","${flag2}"}),
@Result(name="bbbb",location="bbbb!bbbb.action",type="redirect",
params = {"flag","${flag}","flag2","${flag2}"}
)
}
)
public class MyAction extends ActionSupport{
private String flag ;
private String flag2;
public String jump(){
if(flag!= null&&flag.equals("aaaa")){
return "aaaa";
} else{
return "bbbb";
}
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag2() {
return flag2;
}
public void setFlag2(String flag2) {
this.flag2 = flag2;
}
}
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.opensymphony.xwork2.ActionSupport;
@Results(
{
@Result(name="aaaa",location="aaaa!aaaa.action",type="redirect",
params = {"flag","${flag}","flag2","${flag2}"}),
@Result(name="bbbb",location="bbbb!bbbb.action",type="redirect",
params = {"flag","${flag}","flag2","${flag2}"}
)
}
)
public class MyAction extends ActionSupport{
private String flag ;
private String flag2;
public String jump(){
if(flag!= null&&flag.equals("aaaa")){
return "aaaa";
} else{
return "bbbb";
}
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag2() {
return flag2;
}
public void setFlag2(String flag2) {
this.flag2 = flag2;
}
}
AaaaAction.java
package com.zzn.action;
import com.opensymphony.xwork2.ActionSupport;
public class AaaaAction extends ActionSupport {
private String flag;
private String flag2;
public String aaaa(){
System.out.println("我调用的aaaa方法"+flag+"~~~~~"+flag2);
return "page";
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag2() {
return flag2;
}
public void setFlag2(String flag2) {
this.flag2 = flag2;
}
}
import com.opensymphony.xwork2.ActionSupport;
public class AaaaAction extends ActionSupport {
private String flag;
private String flag2;
public String aaaa(){
System.out.println("我调用的aaaa方法"+flag+"~~~~~"+flag2);
return "page";
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag2() {
return flag2;
}
public void setFlag2(String flag2) {
this.flag2 = flag2;
}
}
BbbbAction.java
package com.zzn.action;
import com.opensymphony.xwork2.ActionSupport;
public class BbbbAction extends ActionSupport {
private String flag;
private String flag2;
public String bbbb(){
System.out.println("我调用的bbb方法"+flag);
return "page";
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag2() {
return flag2;
}
public void setFlag2(String flag2) {
this.flag2 = flag2;
}
}
import com.opensymphony.xwork2.ActionSupport;
public class BbbbAction extends ActionSupport {
private String flag;
private String flag2;
public String bbbb(){
System.out.println("我调用的bbb方法"+flag);
return "page";
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag2() {
return flag2;
}
public void setFlag2(String flag2) {
this.flag2 = flag2;
}
}