作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
每次我在数据表中添加新行(通过命令按钮“新反馈”)时,它都会添加到数据表的底部。如何添加它并确保它出现在顶部?
<h:form>
<h:inputText value="#{helloBean.content}" ></h:inputText>
<h:commandButton value="send message"
action="#{helloBean.multiAufruf}">
</h:commandButton>
<h:commandButton value="new Feedback"
action="#{helloBean.gettingFeedbackMulti}">
</h:commandButton>
<h:dataTable value="#{helloBean.sentMessagesList}" var="message">
<h:column>
<h:inputText value="#{message.content}"></h:inputText>
</h:column>
<h:column>
<h:outputText value="#{message.time}"></h:outputText>
</h:column>
<h:column>
<h:outputText value="#{message.idList}"></h:outputText>
</h:column>
<h:column>
<h:outputText value="#{message.feedbackz}"></h:outputText>
</h:column>
</h:dataTable>
</h:form>
最佳答案
在命令 gettingFeedbackMulti
的操作方法中,您可能正在执行类似的操作
sentMessagesList.add(message);
只需将其更改为使用 add()
和索引参数,如下所示
sentMessagesList.add(0, message);
这会将其添加到列表的索引 0
关于java - 如何在 JSF 中的数据表顶部添加新行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44974012/
我是一名优秀的程序员,十分优秀!