标签灵活运用,action直接跳转到任意页面

struts2里struts.xml配置文件的的片段:
<global-results>
<result name="pagepath">${pagepath}</result>
<result name="pagepathaction" type="redirect">${pagepathaction}</result>
</global-results>



action里写法:
protected String pagepath = "";
protected String pagepathaction = "";
public final String PAGEPATH = "pagepath";
public final String PAGEPATHACTION = "pagepathaction";


public String getPagepathaction() {
		return pagepathaction;
	}
	public void setPagepathaction(String pagepathaction) {
		this.pagepathaction = pagepathaction;
	}

	public String getPagepath() {
		return pagepath;
	}

	public void setPagepath(String pagepath) {
		this.pagepath = pagepath;
	}public String returnpagepath() throws Exception
	{
		this.pagepath = "/success.jsp";
		return PAGEPATH;
	}


你可能感兴趣的:(action)