JSF,panelGrid项之间的空间

时间:2018-09-26 16:24:45

标签: jsf panelgrid

我有这段代码,我想利用左边的空间(未提交的值)...

            [![<h:panelGrid columns="2" cellpadding="5" >
                <p:outputLabel value="Field1:" for="itField1" />
                <p:inputText id="itField1" style="width:200px" required="true"
                             value="#{bean.field1}">
                </p:inputText>
                <p:outputLabel value="Field2:" for="itField2" />
                <h:panelGrid columns="2" style="width:200px"  cellpadding="0" cellspacing="0" >
                    <p:inputText id="itField2" required="true" 
                         value="#{="#{bean.field2}"
                         />
                    <p:commandButton icon="fa fa-search"
                                     />
                </h:panelGrid>
                <p:outputLabel value="Field3:" for="itField3" />
                <p:inputText id="itField3" style="width:200px" required="true"
                             value="#{bean.field3}">
                </p:inputText>
            </h:panelGrid>]

我想要这个! enter image description here

但是,我得到了:( enter image description here

如何做到?

1 个答案:

答案 0 :(得分:0)

这可以通过向width:100%<p:inputText id="itField2" ..... />添加 CSS 样式<p:commandButton .... />来实现,如下所示:

<p:inputText id="itField2" value="#{bean.field2}" required="true" style="width:100%"  />
<p:commandButton icon="fa fa-search" style="width:100%" />