Struts動態結果集
我們可以在action中動態指定結果集的location,其實就是在struts.xml文件中拿到action的屬性而已。
UserAction
public class UserAction extends ActionSupport
{
private String path;
private String type;
public String execute()
{
if(type == "1")
{
path = "xy.jsp";
}
else path = "xy2.jsp";
return success;
}
}
Getter和Setter省略
Struts.xml
<action name="uaction" >
<result>${path}</result>
</action>
簡單吧。
最後更新:2017-04-02 16:47:54