Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 在包含两个表单的页面中显示错误消息时出现问题_Jsf 2_Richfaces - Fatal编程技术网

Jsf 2 在包含两个表单的页面中显示错误消息时出现问题

Jsf 2 在包含两个表单的页面中显示错误消息时出现问题,jsf-2,richfaces,Jsf 2,Richfaces,我正在开发一个JSF页面,因为我有两个表单。我正在使用两种形式的rich:messages 假设在第一种形式中,如果我没有输入任何必填字段并单击Save,那么错误消息将在页面中显示两次(正如我在两种形式中使用的rich:messages) 是否有任何方法可以显示有关表单的错误消息 提前感谢。如果您使用的是RichFaces 3.3.3.Final,您可以这样做: <a4j:form id="tmpfrm1"> <rich:messages /> <h

我正在开发一个JSF页面,因为我有两个表单。我正在使用两种形式的rich:messages

假设在第一种形式中,如果我没有输入任何必填字段并单击Save,那么错误消息将在页面中显示两次(正如我在两种形式中使用的rich:messages

是否有任何方法可以显示有关表单的错误消息


提前感谢。

如果您使用的是RichFaces 3.3.3.Final,您可以这样做:

<a4j:form id="tmpfrm1">
    <rich:messages />
    <h:inputText value="#{mybean.intmp1}" required="true"/>
    <a4j:commandButton value="save" action="#{mybean.test1}" reRender="tmpfrm1" limitToList="true" />
</a4j:form>

<a4j:form id="tmpfrm2">
    <rich:messages />
    <h:inputText value="#{mybean.intmp2}" required="true"/>
    <a4j:commandButton value="save" action="#{mybean.test2}" reRender="tmpfrm2" limitToList="true" />
</a4j:form>

如果您使用的是RichFaces 4,则需要将limitToList替换为limitRender,将reRender替换为render