2013-01-21 15 views
0

我這樣定義一個自定義標籤:的facelet定製標記僅適用於一個實體

<?xml version="1.0" encoding="UTF-8"?> 
    <html xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:ui="http://java.sun.com/jsf/facelets" 
     xmlns:f="http://java.sun.com/jsf/core" 
     xmlns:h="http://java.sun.com/jsf/html" 
     xmlns:a4j="http://richfaces.org/a4j" 
     xmlns:rich="http://richfaces.org/rich" 
     xmlns:composite="http://java.sun.com/jsf/composite"> 

     <!-- INTERFACE --> 
     <composite:interface> 
      <composite:attribute name="terminal" /> 
      <composite:attribute name="prefix" /> 
     </composite:interface> 

     <!-- IMPLEMENTATION --> 
     <composite:implementation> 
      <h:panelGrid columns="3" columnClasses="titleCell"> 
       <h:outputLabel for="#{prefix}nodeId" value="Node Id" /> 
       <h:selectOneMenu id="#{prefix}nodeId" 
        value="#{cc.attrs.terminal.nodeId}" 
        converter="javax.faces.Integer"> 
        <f:selectItems 
         value="#{terminalController.availableNodeIds}" /> 
        <rich:validator /> 
       </h:selectOneMenu> 
       <rich:message for="#{prefix}nodeId" id="cnodeIdMsg" /> 

       <h:outputLabel for="#{prefix}maxcon" value="Max Connections" /> 
       <h:inputText id="#{prefix}maxcon" 
        value="#{cc.attrs.terminal.maxConnections}"> 
        <rich:validator /> 
       </h:inputText> 
       <rich:message for="#{prefix}maxcon" /> 
      </h:panelGrid> 
     </composite:implementation> 
</html> 

當我中了豐富的使用它:popupPanel

<my:terminalForm prefix="c" terminal="#{newTerminal}"/> 

一切工作正常。

在同一文件中的另一個地方(也豐富:popupPanel)

<my:terminalForm prefix="e" terminal="#{terminalController.editTerminal}"/> 

在我的表單中的所有值沒有得到初始化。我懷疑表達式#terminalController.editTerminal}未能正確擴展。但是,當我從自定義標籤中直接寫入標籤時,所有內容都可以正常工作,但將自定義標籤僅用於一個擴展將毫無意義。

什麼可能是錯的?

有沒有人更有經驗有一個想法,我可以調試這個問題?

回答

2

cc.attrs在前綴前面沒有?!

+0

謝謝,你無法想象我檢查了多少次。 – stacker

+0

我知道那種感覺:) –

相關問題