<h:inputText id="userAgeID" required="true" value="#{userBean.userAge}" converter="javax.faces.Integer"> <f:converter converterId="javax.faces.Integer"/> JSF 轉換器ID對映類別表Notice that our recipes make use of JSF 2.0 features, such as annotation, new navigation style, and no faces-config.xml file. Especially you must notice the new @FacesConverter annotation for indicating to a normal class that it is a JSF 2.0 converter. immediate="boolean"轉換和驗證過程發生在應用請求值(僅當 immediate=true 驗證階段不在進行處理)、處理驗證 和呈 現響應 階段即可。 其實, immediate =false 時,轉換和驗證運行在 驗證處理階段. immediate =true 時,轉換和驗證運行在 應用請求值階段, 驗證處理階段不運行. (直接跳過 PROCESS_VALIDATIONS) Ref, http://www.blogjava.net/algz/articles/155325.html <f:converterDateTime pattern="dd/MM/yyyy" /> |