我有以下FacesValidator:JSF自定義驗證:H:消息不被渲染
至極被以下列方式使用:
<h:form id="profileform" action="#{userController.updatePassword}">
<h:messages errorClass="error_message" globalOnly="true"/>
...
<h:outputLabel for="password" value="Old password:" />
<h:inputSecret id="password" name="password" label="Old password">
<f:validateLength minimum="8" maximum="15" />
<f:validator validatorId="passwordValidator"/>
</h:inputSecret>
<h:message for="password" errorClass="error_message"/>
...
</h:form>
現在的問題是,該消息驗證器生成的內容從不顯示。我知道它就會產生,因爲在與GlassFish日誌,我可以看到
profileform:password: Old password is wrong!
我看不出在這個任何錯誤特別是因爲被顯示爲f:validateLength
的消息,如果密碼是長還是短。 如果我的
context.addMessage(comp.getClientId(context), msg);
context.addMessage(null, msg);
代替消息顯示在h:messages
組件。 有沒有人有想法?在此先感謝
想知道,你使用Seam 3嗎?由於通常PhaseListeners不是注入目標,注入實體管理器工廠不起作用。 – 2011-05-29 18:15:38