2017-06-09 75 views
0

我正在實現我的自定義組件,如下所示。放置此文件web->資源文件夾複合屬性在jsf自定義組件中返回null

<html 
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:composite="http://java.sun.com/jsf/composite" 
     > 
    <h:body> 
     <composite:interface> 
      <composite:attribute name="width" default="300"/> 
      <composite:attribute name="height" default="400"/> 
     </composite:interface> 
     <composite:implementation> 
      <h:inputText style="height: #{composite.attrs.height}px"></h:inputText> 
      <span> #{composite.attrs.height}</span> 
     </composite:implementation> 
    </h:body> 
</html> 

但attrs.height什麼都不返回。

自定義組件類似於下面

<my:mycustom height="40"></my:mycustom> 

我在這裏做了錯誤。任何人都可以幫助我做到這一點。

回答

0

我發現了這個問題,使用名稱空間作爲複合來獲得屬性(#{composite.attrs.height}) 但是這看起來不正確,並且使用cc而不是composite,並且它的返回正確。

{cc.attrs.height}