閱讀480 返回首頁    go 阿裏雲 go 技術社區[雲棲]


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

  上一篇:go 完成web開發必知工具
  下一篇:go Android 內存管理