开发者

validation in struts 2 using xml file

开发者 https://www.devze.com 2023-03-13 06:15 出处:网络
<field-validator type=\"requiredstring\"> <message>passwordrequired,enter again</message>

    <field-validator type="requiredstring">

        <message>password  required,enter again</message>

    </field-validator>


   <field-validator type="fieldexpression">
    <param name="expression">password.equals('prernagolani')</param>
        <message>invalid password</message>
    </field-validator>

</field>

this is the xml file for validation of my password field,but when i submit form with empty string it is showing both the errors

1.invalid password 2.password requir开发者_开发问答ed,enter again

i want if feild is empty then it should show only second message not the first one mentioned above


User Short-circuiting validators: http://struts.apache.org/2.0.14/docs/validation.html#Validation-ShortCircuitingValidator

"A FieldValidator that gets short-circuited will only prevent other FieldValidators for the same field from being evaluated."

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号