-
Struts2的后綴 有3處可以設置 struts.xml(constant標簽 name="strust.action.extension" value="**") 、struts.properties (strust.action.extension=**) 、web.xml(struts過濾器初始參數strust.action.extension 參數值**) **表示后綴值多個可以用英文逗號分開。查看全部
-
處理結果類型查看全部
-
4-4-4 動態方法調用(指定多個配置文件) <include file="***.xml"> </include> <constant name="struts.i18n.encoding" value="UTF-8"> </constant>查看全部
-
4-4-3 動態方法調用(動態方法調用) 解決一個Action對應多個請求的處理,以免Action太多。 (1)指定method屬性 [多個方法需要寫多個action,工作量大] (2)感嘆號方式 [struts2 并不推薦] <constant name="struts.enable.DynamicMethodInvocation" value="true"></constant> <result name="">***</result> http://127.0.0.1:8080/HelloWorld/helloworld!add.action (3)通配符方式 [官方推薦使用]查看全部
-
Action的搜索順序: http://localhost:8080/struts2/path1/path2/path3/student.action 第一步:判斷package是否存在,如:path1/path2/path3 (1)存在 第二步:判斷action是否存在,如果不存在則去默認的namespace的 package里面尋找action 第三步:如果沒有,則報錯 (2)路徑包不存在 第二步:檢查上一級路徑的package是否存在(直到默認namespace,重復第一步)查看全部
-
核心配置文件:(1)web.xml(2)struts.xml文件 struts.xml文件中包含的的內容: 1. 全局屬性 2. 用戶請求和相應Action之間的對應關系 3. Action可能用到的參數與返回結果 4. 各種攔截器的配置 核心文件3 struts.properties該文件包含很多key-value對 該文件可以配置在struts.xml文件中查看全部
-
Struts 2 提供了3種方式去訪問Servlet API (1)ActionContext (2)實現***Aware接口 (3)ServeltActionContext查看全部
-
運行struts2的環境要求: (1)Servlet API 2.4 (2)JSP API 2.0 (3)Java JDK 1.5 或者以上 使用步奏: (1)將struts 添加到項目中: Apache官網下載struts庫文件,解壓; 將lib目錄下struts.jar文件復制到項目WEB-INF/lib之下; 其他文件則復制到/WEB-INF文件夾下,然后在該文件夾下創建struts-config.xml配置文件. (2)給項目添加struts2支持 (3)創建Action進行測試查看全部
-
struts.properties查看全部
-
struts.properties查看全部
-
struts.xml查看全部
-
StrutsPrepareAndExecuteFilter針對struts2.1.2以后查看全部
-
用戶的請求HttpServletRequest--->過濾器filter--->ActionMapper(.action)請求---->過濾器---->ActionProxy---->通過ConfigurationManager讀取struts.xml中的ActionInvocation具體的Action類---->通過ActionProxy創建Action反向實例---->攔截器--->action,返回result(字符串對象)對應的視圖---->攔截器---->HttpServletResponse返回請求查看全部
-
用戶的請求HttpServletRequest--->過濾器filter--->ActionMapper(.action)請求---->過濾器---->ActionProxy---->通過ConfigurationManager讀取struts.xml中的ActionInvocation具體的Action類---->通過ActionProxy創建Action反向實例---->攔截器--->action,返回result(字符串對象)對應的視圖---->攔截器---->HttpServletResponse返回請求查看全部
-
redirect 重定向在處理結果是會丟失參數??!查看全部
舉報
0/150
提交
取消