struts2 05 action萬用字元

2021-06-23 08:01:09 字數 564 閱讀 9015

實現動態訪問還可以通過萬用字元

eg:

/success_.jsp

當訪問時 如果輸入 http://localhost:8080/demo/useradd

就會匹配到這個action。這時*就匹配為add  後面method的1的意思是第乙個星號,所以 也就是等於 method="add"

下面同理。即 success_add.jsp。

這樣可以實現動態訪問。

比如 訪問換成http://localhost:8080/demo/userdel   就會去呼叫manager類中的del方法。返回的頁面也變為succes_del.jsp

這樣不用更改action實現了動態訪問。

Struts的action跳轉大全

struts的 action 跳轉 1 完整的action name someform input somejsp.jsp 首先,struts 的actionservlet 接收到乙個請求,然後根據 struts config.xml 的配置定位到相應的 對映 接下來如果 form 的範圍是 req...

struts的action跳轉大全

1 完整的action name someform input somejsp.jsp 這樣做的效果是 execute 僅當validate 成功以後才執行 input屬性指定的是乙個uri。2 僅有form的action 首先,struts會在定義的scope搜尋someform,如果找到則重用,...

Struts 的action請求方式

在struts2中關於action的請求url請求基本上由三種情況 首先要先提下struts在傳送請求的處理流程 客戶端請求 http localhost 8080 helloworld stu stuadd tomcat接收請求 根據helloworld這個專案來載入處理web.xml 把請求交給...