<h:panelgroup layout =“block”>不会向HTML呈现任何内容

时间:2016-11-04 02:28:38

标签: jsf html-rendering

我正在尝试在<h:panelGroup layout="block">中显示一些元素。元素正在屏幕上显示,但HTML <div>根本没有呈现。

这是我的JSF代码:

<h:form id="editProfile">
    <div class="password-container">
        <h:outputText class="edit-header" value="Change Password &#8594;"></h:outputText>
        <br />
        <br />
        <!-- this div is not being displayed,
             THE ELEMENTS INSIDE THE PANELGROUP ARE BEING DISPLAYED -->
        <h:panelGroup layout="block">
            <h:inputText a:placeholder="Present Password" id="password" 
                value="#{editProfile.password}"
                class="cff-inputText"></h:inputText>
            <br />
            <h:inputText a:placeholder="New Password" id="change-password"
                class="cff-inputText"></h:inputText>
            <br />
            <button id="cancel-password" class="cff-button">Cancel</button>
            <button id="ok-password" class="cff-button">OK</button>
        </h:panelGroup>
    </div>
</h:form>

这是生成的HTML输出:

 //This is not the panelGroup div
 <div class="password-container"><span class="edit-header">Change Password →</span>
                       <br /><br />

   //These are the elements inside the div! but the panelGroup Div is not being rendered
   <input id="editProfile:password" type="text" name="editProfile:password" class="cff-inputText" placeholder="Present Password" />
       <br /><input id="editProfile:change-password" type="text" name="editProfile:change-password" class="cff-inputText" placeholder="New Password" />
       <br />
       <button id="cancel-password" class="cff-button">Cancel</button>
       <button id="ok-password" class="cff-button">OK</button>

 </div><input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:0" value="6732837357534288958:1301728140408675513" autocomplete="off" />

有人可以告诉我哪里出错了吗?

1 个答案:

答案 0 :(得分:5)

您需要添加idstylestyleClass属性,以确保呈现<div>。基本上,它会添加,如果需要

docs

  

旨在用于只能嵌套一个UIComponent子项的情况,例如facet。

在这种情况下,您可能应该使用普通<div>而不是h:panelGroup

相关问题