struts2 重定向、动态跳转

struts.xml:

 

<action name="main*" class="com.struts.test.action.MainAction">
    <result name="page">${url}</result>
</action>

 MainAction:

 

public class MainAction implements Action{
    private String url;
    public String getUrl() {
	return url;
    }

    public void setUrl(String url) {
	this.url = url;
    }

    @Override
    public String execute()throws Exception(){
        //业务逻辑,动态获取url路径
        url="/index.jsp";
        return "page";
    }

}
 

 

你可能感兴趣的:(struts2)