日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
WebWork配置筆記

在標(biāo)簽方面,WebWork配置這幾個(gè)標(biāo)簽是有嚴(yán)格順序的,正確順序如下:

 
 
 
  1. 先〈result-types〉,必須有〈result-type/〉項(xiàng);       
  2. 再〈interceptors〉,必須有〈interceptor/〉項(xiàng);       
  3. 接下來(lái)是〈default-interceptor-ref   name="completeStack"〉  
  4. default-interceptor-ref〉;       
  5. 然后是〈global-results〉,必須有〈result/〉項(xiàng);       
  6. 然后〈global-exception-mappings〉,    
  7. 子項(xiàng)如〈exception-mapping result="errorPage"     
  8. exception="java.lang.Exception"/〉       
  9. ***才是〈action/〉    

***才是

 
 
 
  1. 〈action name="test" 〉     
  2. 〈interceptor-ref name="exception"/ 〉     
  3. 〈interceptor-ref name="basicStack"/ 〉     
  4. 〈exception-mapping exception="com.acme.  
  5. CustomException" result="custom_error"/ 〉     
  6. 〈result name="custom_error" 〉custom_error.ftlresult 〉     
  7. 〈result name="success" type="freemarker" 〉test.ftlresult 〉     
  8. action 〉     

webwork運(yùn)行流程: 

默認(rèn)執(zhí)行execute()方法,該方法默認(rèn)返回SUCCESS;

 
 
 
  1. 〈Script language="JavaScript" src="/js/pagenumber.js" 〉  
  2. 〈/Script 〉     
  3. 〈script Language="JavaScript" 〉     
  4. listNumUrl("courseInfoList.action?&pageNum=" 
  5. ,${pageNum},${allPageNum});     
  6. 〈/script 〉  

Ognl工作原理:

OgnlValueStack stack=new OgnlValueStack();  

stack.push(new User())://首先將打算賦值的對(duì)象壓入棧中  

stack.setValue("name","erica");//為棧頂對(duì)象User指定的屬性名name賦值  

HttpSession是一個(gè)接口,  

Properties實(shí)現(xiàn)了繼承了HashTable(實(shí)現(xiàn)了Map接口),也就是說(shuō)它保存的也是值-鍵對(duì)象,它的setProperty("name","value")實(shí)質(zhì)上就是保存到HashTable里了。

默認(rèn)不是ajax

 
 
 
  1. 〈action name="itemPersonalInput"   
  2. class="cn.com.s520.course.ItemPersonalInputAction"〉    
  3. 〈interceptor-ref name="fileUpload"〉    
  4. 〈param name="allowedTypes"〉    
  5. application/msword,image/gif,  
  6. image/jpeg,image/pjpeg,application/x-shockwave-flash     
  7. param〉    
  8. 〈param name="maximumSize">10485760param〉    
  9. interceptor-ref〉    
  10. 〈interceptor-ref name="basicStack"/〉    
  11. 〈result name="input" type="freemarker">  
  12. /course/ItemPersonalInput.ftlresult〉    
  13. 〈result name="error" type="freemarker">  
  14. course/ItemPersonalInput.ftlresult〉    
  15. 〈result name="success" type="redirect">  
  16. /itemPersonalList.actionresult〉    
  17. action〉  

private File images;

private String imagesContentType;  

private String imagesFileName;//得到不含路徑的文件名,如test.jpg 

 
 
 
  1. 〈result name="success" type="stream" 〉    
  2. 〈param name="contentType">image/jpegparam 〉    
  3. 〈param name="inputName">imageStreamparam 〉    
  4. 〈param name="  
  5. contentDisposition">filename="logo.png"param 〉    
  6. 〈param name="bufferSize">4096param 〉    
  7. result> 

1,〈param name="contentType">application/x-msdownloadparam 〉


contentType設(shè)成 application/x-msdownload 就可以。這樣瀏覽器會(huì)保證彈出一個(gè)下載文件的對(duì)話框。 


2,inputName 這個(gè)比較重要,這個(gè)名字是輸入流的名稱, 以后要steam result的實(shí)現(xiàn)類中為根據(jù)OGNL的表達(dá)式去查找的。 

contentDisposition 這個(gè)是下載之后,保存在用戶端的文件名稱。

3,另外一個(gè)參數(shù):contentLength就是下載文件的大小,webwork的stream result似乎實(shí)現(xiàn)有問(wèn)題,不能根據(jù)文件的大小動(dòng)態(tài)進(jìn)行設(shè)置,只能寫(xiě)死。 

這個(gè)WebWork配置參數(shù)的意義是告訴瀏覽下載的文件有多大,以便瀏覽器正確的顯示進(jìn)度條。如果這個(gè)功能很重要的話,可以重新寫(xiě)一個(gè)RESULT來(lái)實(shí)現(xiàn)。

 
 
 
  1. 〈result>/form.jspresult>如果不指明,默認(rèn)為success     
  2. 〈action name="userReg"   
  3. class="com.opensymphony.xwork.ActionSupport" 〉    
  4. 〈result name="input">/app/userreg.ftlresult 〉    
  5. 〈/action 〉  

這里將不會(huì)出現(xiàn)預(yù)期的頁(yè)面,因?yàn)槟J(rèn)為success,不會(huì)轉(zhuǎn)向我們指定的input頁(yè)面

 
 
 
  1. 〈result name="no-content" type="header"〉     
  2. 〈param name="status"〉204param〉     
  3. 〈param name="headers.customHeaderA"〉A(chǔ)param〉     
  4. 〈param name="headers.customHeaderB"〉Bparam〉     
  5. result〉  

chain視圖:  

同一個(gè)包里,可設(shè)置type為chain,對(duì)應(yīng)action的擴(kuò)展名也可以不寫(xiě),

 
 
 
  1. 〈result name="error" type="chain"〉     
  2. 〈param name="actionName"〉barparam〉     
  3. result〉     

不同包里

 
 
 
  1. 〈result name="errorPage" type="chain" 〉     
  2. 〈param name="namespace" 〉/param 〉     
  3. 〈param name="actionName" 〉barparam 〉     
  4. result 〉     

或者設(shè)置type為redirect,重定向過(guò)去

 
 
 
  1. 〈action name="index" class="  
  2. com.opensymphony.xwork.ActionSupport"〉     
  3. 〈result name="success" type="redirect"〉  
  4. /course/courseInfoList.actionresult〉     
  5. action〉   

 
 
 
  1. 〈default-interceptor-ref name="defaultStack"/〉   

這里只是在你沒(méi)有設(shè)置攔截器時(shí)才用到,如果WebWork配置攔截器了,就不會(huì)調(diào)用這個(gè)了。


本文題目:WebWork配置筆記
鏈接地址:http://www.5511xx.com/article/dghhjgs.html