h:消息不显示消息

时间:2014-09-05 14:23:11

标签: jsf

我正在尝试在Bean中设置的XHTML中显示成功消息。但是没有显示任何消息。我试着看了很多地方,但无法弄清楚这个问题。以下是我的代码片段。

ManagedBean代码:

try {
        // Service call to register individual
        String text = "Congratulations !!!Registration Successful.";
        FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_INFO,text, text);
        // The component id is null, so this message is considered as a view message
        FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        return "registerSuccess";
    } catch (EmailException e) {
        logger.error(e.getMessage());               
        return "registerFailure";
    }

提交页面:

<h:form>
    <!--The form fields-->
    <h:commandButton value="Confirm" action="#{registerBean.register}"></h:commandButton>
</h:form>

registerSuccess.xhtml

<ui:composition template="/xhtml/common/seeLayout.xhtml">
    <ui:define name="mainContent">
        <f:view transient="true">
            <h:form id="registerSuccessFormId" prependId="false">
                <h3 class="panel-title text-center">Registration Success</h3>
                <label class="info-text">
                    <h:messages globalOnly="true" infoClass="info-text-info" warnClass="info-text-warn" errorClass="info-text-error"></h:messages>                          
                </label>
            </h:form>
      </f:view>
    </ui:define>
</ui:composition>

0 个答案:

没有答案