【发布时间】:2016-10-02 12:35:44
【问题描述】:
我遇到了一个问题,我想在表格底部放置一个multiSelectListbox(不是dataTable)。然而,当我这样做时, multiSelectListbox 显示在表格顶部。
以下是我的代码:
<table id="addBookTable" class="common_tab" style="width: 100%;">
<tr>
<th><span style="color: red;">*</span>BookName:</th>
<td><p:inputText styleClass="inputTextClass" id="input_text_1"
placeholder="Input book name" value="#{bookView.newBook.name}"
onblur="onLeave(this)">
</p:inputText></td>
<td>
<h:outputLabel styleClass="errorTipClass" value="book name must be not empty"
id="errorTip1" binding="#{errorTip1}"/>
</td>
<th><span style="color: red;">*</span>ISBN:</th>
<td><p:inputText styleClass="inputTextClass" id="input_text_2"
onkeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))"
placeholder="Input book's ISBN" maxlength="13" value="#{bookView.newBook.isbn}"
onblur="onLeave(this)">
</p:inputText></td>
<td><p:outputLabel styleClass="errorTipClass" value="Must be thirteen bits number"
id="errorTip2" binding="#{errorTip2}" /></td>
</tr>
<tr>
<th><span style="color: red;">*</span>author:</th>
<td><p:inputText styleClass="inputTextClass" id="input_text_3"
placeholder="Input book's author" value="#{bookView.newBook.author}"
onblur="onLeave(this)"/></td>
<td><p:outputLabel styleClass="errorTipClass" value="author must be not empty"
id="errorTip3" binding="#{errorTip3}" /></td>
<th><span style="color: red;">*</span>press:</th>
<td><p:inputText styleClass="inputTextClass" id="input_text_4"
placeholder="Input book's press" value="#{bookView.newBook.press}"
onblur="onLeave(this)"/></td>
<td><p:outputLabel styleClass="errorTipClass" value="press must be not empty"
id="errorTip4" binding="#{errorTip4}" /></td>
</tr>
<tr>
<th><span style="color: red;">*</span>price:</th>
<td><p:inputText styleClass="inputTextClass" id="input_text_5"
style="text-align:right;" placeholder="Input book's price"
value="#{bookView.newBook.price}" onblur="onLeave(this)"/></td>
<td><p:outputLabel styleClass="errorTipClass" value="Input is invalid"
id="errorTip5" binding="#{errorTip5}" /></td>
<th><span style="color: red;">*</span>Publication Date:</th>
<td><p:calendar effect="fold" pattern="yyyy-MM-dd" navigator="true"
yearRange="c-50:#{bookView.currentYear}" lang="zh_CN"
id="newBookPublicationDate" placeholder="Choice book's date of publication"
onblur="this.style.border = '2px green solid'" readonlyInput="true"
value="#{bookView.newBookDate}" style="height:25px;"/></td>
</tr>
<tr>
<p:multiSelectListbox value="#{bookView.newBook.category}" effect="slide" header="Categories" showHeaders="true">
<f:selectItems value="#{bookView.categories}" />
</p:multiSelectListbox>
</tr>
</table>
如果你能帮助我,我将不胜感激,虽然是一个建议。
【问题讨论】:
-
这个问题与 jsf、PrimeFaces 或 java-ee 无关。这是一个普通的html问题。使用纯 html 输入或 div 或其他任何内容都会失败。你需要一个 td 或 th 在一个 tr... 简单明了
-
是的。这个问题只是一个普通的html问题。在发布这个问题之前,我已经按照您的建议尝试了该方法。但是,它不起作用。使用 colspan 属性可以解决这个问题。
-
@Emil Alkalay 请不要使用不当标签。先阅读标签说明!
标签: html jsf primefaces html-table