How to validate fields properly in Struts 2

后端 未结 2 417
感情败类
感情败类 2021-01-26 00:15

I would like to know what I\'m doing wrong here :


    
        

        
2条回答
  •  温柔的废话
    2021-01-26 01:16

    The name is case sensitive, you should use

    
    

    The data can be validated after it's populated to the action. Either you do it in a declarative way using *-validation.xml or programmatically via validate().

    You can configure validation interceptor to choose between these two ways, because by default validate() runs after declarative validations are done even if they are short-circuit.

    Consider using alwaysInvokeValidate parameter. If you use aliased validation files as ActionClass-alias-validation.xml then validations are run for this action alias only. You can use this alias when you map your action methods.

提交回复
热议问题