RequiredMessage不会显示在p:消息

时间:2015-11-05 00:57:42

标签: jsf primefaces

我试图在p:消息中显示requiredMessage但是不起作用。 p:消息只是使用addMessage()显示来自BackingBean的消息。

请参阅:

<p:messages globalOnly="true" autoUpdate="true" />
<h:form id="frmRegistro">
                <div class="form-group has-feedback">
                    <h:inputText value="#{usuarioLogadoMB.newUser.nomeCompleto}"
                        styleClass="form-control" alt="Nome Completo"
                        pt:placeholder="Nome completo" />
                    <span class="glyphicon glyphicon-user form-control-feedback"></span>
                </div>
                <div class="form-group has-feedback">
                    <h:inputText value="#{usuarioLogadoMB.newUser.email}" id="iptEmail"
                        required="true" requiredMessage="O email é obrigatório"
                        styleClass="form-control" alt="Email" pt:placeholder="Email" />
                    <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                </div>
                <div class="form-group has-feedback">
                    <h:inputSecret value="#{usuarioLogadoMB.newUser.senha}"
                        required="true" requiredMessage="A senha é obrigatória"
                        styleClass="form-control" alt="Senha" pt:placeholder="Senha" />
                    <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                </div>
                <div class="form-group has-feedback">
                    <h:inputSecret value="#{usuarioLogadoMB.newUser.confirmacaoSenha}"
                        required="true"
                        requiredMessage="A confirmação da senha é obrigatória"
                        styleClass="form-control" alt="Repita a senha"
                        pt:placeholder="Repita a senha" />
                    <span class="glyphicon glyphicon-log-in form-control-feedback"></span>
                </div>
                <div class="row">
                    <div class="col-xs-4">
                        <h:commandButton action="#{usuarioLogadoMB.concluirRegistro()}"
                            value="Registrar" styleClass="btn btn-primary btn-block btn-flat" />
                    </div>
                    <!-- /.col -->
                </div>
            </h:form>

如果我将带有for属性的p:message添加到每个组件中,则消息以内联方式显示,但我想使用p:消息来避免向每个组件添加p:消息。

0 个答案:

没有答案