You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dave Newton (JIRA)" <ji...@apache.org> on 2011/01/09 17:41:45 UTC
[jira] Commented: (WW-3556) Annotation validations
(@RequiredStringValidator) doesn't work while set shortCircuit = true
[ https://issues.apache.org/jira/browse/WW-3556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12979360#action_12979360 ]
Dave Newton commented on WW-3556:
---------------------------------
@RequiredStringValidator is a field validator if you don't change the type. As discussed in the referenced WW-2485, short-circuiting doesn't mean what most people believe it does when discussing field validators.
>From the docs at http://struts.apache.org/2.x/docs/validation.html#Validation-ShortCircuitingValidator:
> A FieldValidator that gets short-circuited will only prevent other FieldValidators for the same field from being evaluated.
That aside: forcing a user to fill out a form an arbitrary number of times to meet all the validation requirements is pretty a pretty hostile user experience.
> Annotation validations (@RequiredStringValidator) doesn't work while set shortCircuit = true
> --------------------------------------------------------------------------------------------
>
> Key: WW-3556
> URL: https://issues.apache.org/jira/browse/WW-3556
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.1.1
> Environment: windows 7,Struts2.2.1.1
> Reporter: lishunli
> Attachments: site.jpg
>
>
> I use @RequiredStringValidator to check file is not null,and set shortCircuit = true, when user.username and user.password all is null,and will display 'username is null' and 'password is null 'error info.
> Expected: Only show 'username is null' msg because of setting hortCircuit = true
> Code:
> @Validations(
> requiredStrings = {
> @RequiredStringValidator(fieldName = "user.username", message = "username is null",shortCircuit = true),
> @RequiredStringValidator(fieldName = "user.password", message = "password is null",shortCircuit = true)
> })
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.