简体   繁体   English

如何在inputText旁边创建JSF outputLabel

[英]How to create JSF outputLabel next to inputText

I am creating a few outputLabels and corresponding inputText components, but the Label always appears above the textfield. 我正在创建一些outputLabel和相应的inputText组件,但Label始终显示在文本字段上方。 I haven't found any attribute controlling this so far. 到目前为止,我还没有找到控制它的任何属性。

How do I get the label next to the input? 如何获得输入旁边的标签?

You can use PanelGrid , Which in turn generates TABLE tag in HTML. 您可以使用PanelGrid ,然后在HTML中生成TABLE标记。

<h:panelGrid columns="2">
   <h:outputLabel>Name:</h:outputLabel>
   <h:inputText/>

   <h:outputLabel>Email:</h:outputLabel>
   <h:inputText/>

   <h:outputLabel>Passowrd:</h:outputLabel>
   <h:inputSecret/>
</h:panelGrid>

Once you define the columns=2 it inserts the components side by side in each cell respectively. 一旦定义columns=2它就会分别在每个单元格中并排插入组件。
There is also h:column which you can use. 您还可以使用h:column
But you can not perform ROWSPAN and COLSPAN in JSF as in HTML, however if you still want ROWSPAN and COLSPAN you can go for 3rd party JSF component Libriries like Primefaces , Richfaces ... 但是你不能像在HTML中那样在JSF中执行ROWSPAN和COLSPAN,但是如果你仍然需要ROWSPAN和COLSPAN,那么你可以选择PrimefacesRichfaces等第三方JSF组件Libriries ......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM