嗨大家好我想要实现不同的输入字段,如果有些没有放在文本字段中,请直接从文本字段显示消息。如果输入正确,则显示对话框。
我正在使用primefaces 3.5和jsf 2.1
感谢您的帮助。
reg.xhtml
<ui:composition template="/META-INF/templates/templateLogin.xhtml">
<ui:define name="title">
<h:outputText value="Register"/>
</ui:define>
<ui:define name="content">
<h:form id="regiForm">
<p:panelGrid >
<p:row style="height:20%">
<p:column><h:outputLabel value="#{msg['regi_firstname']}" /></p:column>
<p:column>
<p:inputText style="width:350px" id="firstname"
value="#{regiBean.firstname}" required="true" requiredMessage="#{msg['regi_firstname_error']}" />
</p:column>
<p:column><p:message for="firstname"/></p:column>
</p:row>
<p:row style="height:20%">
<p:column><h:outputText/> </p:column>
<p:column>
<p:commandButton style="width:350px" type="submit" actionListener="#{regiBean.showDialog}"
value="#{msg['regi_button']}" />
</p:column>
<p:column></p:column>
</p:row>
</p:panelGrid>
<p:dialog id="dialog" header="#{msg['regi_dialog_header']}" widgetVar="myDialog" position="center center" >
<h:outputText value="#{msg['regi_dialog']}" />
</p:dialog>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</f:view>
</html>
答案 0 :(得分:1)
p:commandButton使用ajax作为默认值,因此您必须更新面板或添加属性ajax = false以使页面刷新并显示消息