How to customize JSF validation error message

后端 未结 3 1535
小蘑菇
小蘑菇 2020-12-01 21:02

How can I customize the validation message that appears when validation fails?

Here is the code I have:


    

3条回答
  •  萌比男神i
    2020-12-01 21:12

    In addition to Daniel's answer you could always use the label attribute for your input components to remove the client-id (j_idt10:userNo:) from the error message.

    E.g. with

    
      
    
    

    will produce:

    User number: Validation Error: Specified attribute is not between the expected values of 3 and 6.

    The label attribute can be an el expression as well to change this part of the error message dynamically.

提交回复
热议问题