国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
JSP2.1 Deferred Expression的一點(diǎn)筆記
Deferred Expression是JSP2.1中的新特性, 說(shuō)白了就是因?yàn)樵瓉?lái)JSF中有了這個(gè),然后想把JSP和JSF的EL都給統(tǒng)一起來(lái), 就弄了Unified Expression Language, Sun的文檔也講了一些. 規(guī)范也講了一些.
看看Sun的關(guān)于這個(gè)的一些code:
在JEETCK CTS5中,這是一個(gè)最簡(jiǎn)單的用法, 其實(shí)沒(méi)有體現(xiàn)Deferred Value這個(gè)Deferred的作用, 只是說(shuō)了如何用.
JSP: 是這樣在JSP頁(yè)面調(diào)用的.
xml 代碼
  1. <test:ELDeferredValueValueTag litExpr="foo" poundExpr="#{foo}"/>  
這里這個(gè)poundExpr是Deferred Expression.
TLD: 這里面決定是否用Deferred, 其實(shí)配置起來(lái)還有許多變化.
    
xml 代碼
  1. <attribute>  
  2.   <name>poundExpr</name>  
  3.   <required>true</required>  
  4.   <deferred-value>    //here define to be deferred expression value   
  5.     <type>java.lang.String</type>  
  6.   </deferred-value>  
  7. </attribute>  

   
ELDeferredValueValueTag:具體用還是要在Tag Handler中體現(xiàn), 這里是個(gè)simple tag. 
這里用的是ValueExpression, 也是JSP2.1中新引入的. 
java 代碼
  1. public void setPoundExpr(ValueExpression poundExpr) {//here must use ValueExpression   
  2.     this.poundExpr = poundExpr;   
  3. }   
  4. public void doTag() {   
  5.     ...   
  6.     String poundVal = (String) poundExpr.getValue(elContext);   
  7.     ...   
  8. }  

But not show how deferred expression works
因?yàn)門(mén)CK中沒(méi)有講到如何個(gè)deferred法, 然后去看看JSF的實(shí)現(xiàn).
In JSF RI:
JSP:
  1. <h:inputText value="#{color}}" />  
html_basic.tld:
  1. <tag-class>  
  2.     com.sun.faces.taglib.html_basic.InputTextTag   
  3. </tag-class>  
  4. <tei-class>  
  5.     com.sun.faces.taglib.FacesTagExtraInfo   
  6. </tei-class>  
  7. <attribute>  
  8.     <description>  
  9.         <![CDATA[The current value of this component.]>  
  10.     </description>  
  11.     <name>  
  12.         value   
  13.     </name>  
  14.     <required>  
  15.         false   
  16.     </required>  
  17.     <deferred-value>  
  18.         <type>  
  19.             java.lang.Object   
  20.         </type>  
  21.     </deferred-value>  
  22. </attribute>  
  23. <attribute>  


 Tag handler file:
InputTextTag.setProperties() //set the value to UIComponent
    UIComponentELTag.createComponent
 
javax.faces.component.UIInput
在JSF中還沒(méi)有發(fā)現(xiàn)更多的, 主要是對(duì)JSF還不是很熟悉, 看來(lái)得先看看JSF.
之前一直想看看單純用JSP如何使用deferred expresstion的, 但現(xiàn)在一想, jsp只有request/response這一個(gè)階段, 因此不好用. 但JSF也是用jsp實(shí)現(xiàn)的, 它是如何實(shí)現(xiàn)多個(gè)phase的呢?
http://angraze.wordpress.com/2006/10/03/the-jsfjsp-el-mess/ 這篇文章似乎抨擊sun的策略, 認(rèn)為sun這樣搞得很混亂.
猜測(cè)一下JSF是這樣處理deferred expression的:
1. 用javascript把頁(yè)面某個(gè)field跟某個(gè)ValueExpression對(duì)象關(guān)聯(lián)起來(lái)
2. 在不同的lifecycle phase, 把頁(yè)面某個(gè)field跟ValueExpression對(duì)象進(jìn)行同步.
3. 一開(kāi)始,evaluate expression的值, 然后javascript把值傳給后臺(tái), 通過(guò)UIInput set property到封裝的ValueExpression上.
4.在后面的phase, 需要重新evaluate這個(gè)expression的值, 則又先get property,通過(guò)javascript修改頁(yè)面的element
得再看JSF.
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
JSP2.0自定義標(biāo)簽
Jakarta
JSF in Action讀書(shū)筆記(二)自定義UIComponent - smilingl...
JSF框架技術(shù)整理
五、 JSF Expression Language
標(biāo)簽庫(kù)描述文件(TLD)
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服