- Java EE 8 Application Development
- David R. Heffelfinger
- 226字
- 2021-07-02 22:05:00
Validation
Notice that each <h:inputField> tag has a nested <f:validateLength> tag. As its name implies, this tag validates that the entered value for the text field is between a minimum and maximum length. Minimum and maximum values are defined by the tag's minimum and maximum attributes. <f:validateLength> is one of the standard validators included with JSF. Just like with the required attribute of <h:inputText>, JSF will automatically display a default error message when a user attempts to submit a form with a value that does not validate:
Again, the default message and style can be overridden; we will cover how to do this later in the chapter.
In addition to <f:validateLength>, JSF includes other standard validators, which are listed in the following table:

Notice that in the description for <f:validateBean>, we briefly mentioned bean validation. The bean validation JSR aims to standardize JavaBean validation. JavaBeans are used across several other APIs that, up until recently, had to implement their own validation logic. JSF 2.0 adopted the bean validation standard to help validate named bean properties.
If we want to take advantage of bean validation, all we need to do is annotate the desired field with the appropriate bean validation annotation, without having to explicitly use a JSF validator.
For a complete list of bean validation annotations, refer to the javax.validation.constraints package in the Java EE 8 API at https://javaee.github.io/javaee-spec/javadocs/.
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- C語言程序設計(第3版)
- C# 從入門到項目實踐(超值版)
- Vue.js 3.0源碼解析(微課視頻版)
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- Java持續交付
- 基于Swift語言的iOS App 商業實戰教程
- KnockoutJS Starter
- 大模型RAG實戰:RAG原理、應用與系統構建
- VMware虛擬化技術
- GitHub入門與實踐
- Arduino可穿戴設備開發
- Go Systems Programming
- 微信小程序開發圖解案例教程:附精講視頻(第3版)
- 小小的Python編程故事