【发布时间】:2011-04-19 08:23:04
【问题描述】:
我对带有动态列的 dataTable 的消息呈现有疑问。 我希望消息显示在数据表上方,但 id 存在一些问题。
<h:form id="formId">
<!-- Here the jsf has to recognize id column_0 but it doesn't-->
<h:message styleClass="validationError" for="column_0" />
<rich:dataTable id="priorityTable" value="#{bean.matrix}" var="priority">
<rich:columns value="#{bean.ordersOrigin}"
var="ordersOrigin"
index="ind">
<f:facet name="header">
<h:outputText value="#{ordersOrigin}" />
</f:facet>
<!-- Here i have ids from column_0 to column_2-->
<h:inputText value="#{priority[ind].value}" id="column_#{ind}">
<f:validator validatorId="priorityValueValidator"/>
</h:inputText>
<!-- Line * -->
</rich:columns>
</rich:dataTable>
<br/>
<a4j:commandButton value="Apply" action="#{bean.apply}" reRender="formId"/>
</h:form>
问题是 h:message 没有捕捉到消息。但是,如果我在“Line *”中添加相同的内容,一切正常,但看起来很丑。
这似乎很容易解决。你能帮我解决这个问题吗?
【问题讨论】:
-
你用rich:messages标签试过了吗?
-
是的,我做到了,它工作正常。但我认为使用 h:messages 并不是很好的实践,因为它会捕获页面中的所有消息,并且需要添加许多额外的检查。我只是认为使用 h:message 可能会错过一些东西。