开发者

validation in struts 2 using xml file

    <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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜