You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Zahid Nazir (JIRA)" <ji...@apache.org> on 2008/02/12 21:03:40 UTC

[jira] Created: (WW-2485) Annotation valiations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Annotation valiations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
-------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: WW-2485
                 URL: https://issues.apache.org/struts/browse/WW-2485
             Project: Struts 2
          Issue Type: Bug
          Components: XML Validators
    Affects Versions: 2.0.11
         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
            Reporter: Zahid Nazir


Validation doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't work. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zahid Nazir updated WW-2485:
----------------------------

    Description: 
Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks.




  was:
Validation doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks.





> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43210#action_43210 ] 

Zahid Nazir commented on WW-2485:
---------------------------------

First short-circuiting is not enabled on any of the validators.

As I mentioned using 

@RequiredStringValidator(message = "Default Message", key = "errors.required.first", shortCircuit = false, trim = true)
	public void setFirst(String first) {
		this.first = first;
	}

perfectly invoke validation but by replacing @RequiredStringValidator with @StringLengthFieldValidator validation doesn't kick-in

	@StringLengthFieldValidator(message = "Default message", key = "errors.required.first", shortCircuit = false, trim = true, minLength = "1", maxLength = "35")
	public void setFirst(String first) {
		this.first = first;
	}

is there any order of validators or they just get invoked by the specified sequence ?

I also switched to {action}-validation.xml format but the behavior is same.

Thanks for your valuable time and suggestions.


> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43196#action_43196 ] 

Dave Newton commented on WW-2485:
---------------------------------

I'm a bit confused; in the above code there's only one validator per field, so how would you know if short-circuiting was working or not?

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43197#action_43197 ] 

Zahid Nazir commented on WW-2485:
---------------------------------

There are other fields too but I thought I shouldn't clutter the space. basically they are exactly the same as getter/setters for a profile.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zahid Nazir updated WW-2485:
----------------------------

    Summary: Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting  (was: Annotation valiations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting)

updated header for typo.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Validation doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't work. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43226#action_43226 ] 

Zahid Nazir commented on WW-2485:
---------------------------------

Thanks again for your time and effort and my apology for thinking it is a bug. I did searched on struts-user list but didn't find anything and posted it here. 

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43199#action_43199 ] 

Zahid Nazir commented on WW-2485:
---------------------------------

Please see the getter/setter for other attribute

	/**
	 * @return the first
	 */
//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.first", shortCircuit=true)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)
	public String getFirst() {
		return first;
	}

	/**
	 * @param first the first to set
	 */
//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}


> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zahid Nazir updated WW-2485:
----------------------------

    Description: 
Hi,
Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks for your help.




  was:
Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks.





> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zahid Nazir updated WW-2485:
----------------------------

    Resolution: Incomplete  (was: Not A Problem)
        Status: Resolved  (was: Closed)

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43218#action_43218 ] 

Dave Newton commented on WW-2485:
---------------------------------

All your previous code snippets showed short-circuit set to "true", so it's unclear to me how I would have known short-circuiting was disabled.

Secondly, you REALLY need to ask questions on the user list, not in the S2 bug-reporting mechanism.

Thirdly, sometimes looking at the source can be handy. This is from XWork's StringLengthFieldValidator:

        if (val == null || val.length() <= 0) {
            // use a required validator for these
            return;
        }

*Just* using StringLengthFieldValidator will NOT do what you are thinking it will do. You need to use it in combination with RequiredStringValidator.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Newton updated WW-2485:
----------------------------

    Resolution: Not A Problem  (was: Incomplete)
        Status: Resolved  (was: Closed)

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zahid Nazir updated WW-2485:
----------------------------

    Description: 
Validation doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks.




  was:
Validation doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't work. 


Added code snippets.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Validation doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43201#action_43201 ] 

Zahid Nazir commented on WW-2485:
---------------------------------

Well that's not good, communication is the key. My impression of short-circuiting is if a validator is marked as able to do shortCircuit and there is a validation failure then further validators on that action are nor invoked. In current scenario, if first field 'first' doesn't get validated then validation on field 'last' won't get invoked. 

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43200#action_43200 ] 

Dave Newton commented on WW-2485:
---------------------------------

We're not communicating here.

What do you think short-circuiting does?

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43199#action_43199 ] 

zahidnazir edited comment on WW-2485 at 2/12/08 3:54 PM:
----------------------------------------------------------

Please see the getter/setter for other attribute

	/**
	 * @return the first
	 */
//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.first", shortCircuit=true)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)
	public String getFirst() {
		return first;
	}

	/**
	 * @param first the first to set
	 */
//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}


      was (Author: zahidnazir):
    Please see the getter/setter for other attribute

	/**
	 * @return the first
	 */
//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.first", shortCircuit=true)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)
	public String getFirst() {
		return first;
	}

	/**
	 * @param first the first to set
	 */
//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

  
> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Newton closed WW-2485.
---------------------------

    Resolution: Not A Problem

Short-circuiting is for validators on a *single* field, AFAIK: this means that when the first field validation fails no other validators will be run for that field.

See http://struts.apache.org/2.x/docs/validation.html towards the bottom and, for example, the RequireStringValidator annotation JavaDocs.

It's not clear to me if setting the validator type to Validator.SIMPLE (as opposed to the default Validator.FIELD) will cause the behavior you want, but I'm pretty sure you're misunderstanding short-circuiting.

I'm going to close this issue; if you have further questions please ask on the struts-user list as this isn't really an appropriate discussion forum. If after getting answers on the struts-user list you still feel there's a bug you may re-open this issue or create a new one.

Thanks!

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zahid Nazir updated WW-2485:
----------------------------

    Description: 
Hi,
Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks for your help.




  was:
Hi,
Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below

//	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
	public void setFirst(String first) {
		this.first = first;
	}

Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 

Here is the class declaration

@Validation()
public class ProfileSearch extends ActionSupport {

// getter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
	public String getLast() {
		return last;
	}

// Setter
//	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
//	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
	public void setLast(String last) {
		this.last = last;
	}

and jsp snippet

		<s:form action="addressSearch!search" method="post" validate="false">
			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>

I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.

Thanks for your help.





> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Newton closed WW-2485.
---------------------------


All further conversation regarding this issue should take place on the struts-user mailing list.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43203#action_43203 ] 

Zahid Nazir commented on WW-2485:
---------------------------------

Thanks for your valuable time, I really appreciate it. I acknowledge my understanding of short-circuiting was incorrect. 
Thanks. 

However we have side stepped to the main issue why I opened it which was why @StringFieldValidator and @StringLengthFieldValidator were not invoked. 

Please note that in the source code above I just commented out to see the difference otherwise I ran the code with annotations uncommented for @StringFieldValidator, @StringLengthFieldValidator and commented for @RequiredStringValidator.

I will look again in struts-user list.

Thanks.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43204#action_43204 ] 

Dave Newton commented on WW-2485:
---------------------------------

If short-circuiting is on and one of the validators fails the rest won't fire.

@RequiredFieldValidator is probably not very helpful for text boxes since an empty text box will still send back an empty string (not null), so it will never indicate an error for a text field that's rendered on a page.

If the length validator isn't firing then post the minimal code and config to replicate the issue and see what happens (I use them both without incident, so maybe some fresh eyes will be more helpful than mine :)

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43198#action_43198 ] 

Dave Newton commented on WW-2485:
---------------------------------

It would be better if you posted the code snippet for which short-circuiting doesn't work. With only one validator per field I'm not sure how you could tell.

> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=false)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting

Posted by "Zahid Nazir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43210#action_43210 ] 

zahidnazir edited comment on WW-2485 at 2/13/08 6:52 PM:
----------------------------------------------------------

First short-circuiting is not enabled on any of the validators.

As I mentioned using 

@RequiredStringValidator(message = "Default Message", key = "errors.required.first", shortCircuit = false, trim = true)
	public void setFirst(String first) {
		this.first = first;
	}

perfectly invoke validation but by replacing @RequiredStringValidator with @StringLengthFieldValidator validation doesn't kick-in

	@StringLengthFieldValidator(message = "Default message", key = "errors.required.first", shortCircuit = false, trim = true, minLength = "1", maxLength = "35")
	public void setFirst(String first) {
		this.first = first;
	}

is there any order for field validators, and I am not talking about plain validators taking precedence over field validators, or are they just get invoked by the specified sequence ?

I also tried {action}-validation.xml format but the behavior is same.

Thanks for your valuable time and suggestions.


      was (Author: zahidnazir):
    First short-circuiting is not enabled on any of the validators.

As I mentioned using 

@RequiredStringValidator(message = "Default Message", key = "errors.required.first", shortCircuit = false, trim = true)
	public void setFirst(String first) {
		this.first = first;
	}

perfectly invoke validation but by replacing @RequiredStringValidator with @StringLengthFieldValidator validation doesn't kick-in

	@StringLengthFieldValidator(message = "Default message", key = "errors.required.first", shortCircuit = false, trim = true, minLength = "1", maxLength = "35")
	public void setFirst(String first) {
		this.first = first;
	}

is there any order of validators or they just get invoked by the specified sequence ?

I also switched to {action}-validation.xml format but the behavior is same.

Thanks for your valuable time and suggestions.

  
> Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2485
>                 URL: https://issues.apache.org/struts/browse/WW-2485
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.11
>         Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1
>            Reporter: Zahid Nazir
>
> Hi,
> Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true)	
> 	public void setFirst(String first) {
> 		this.first = first;
> 	}
> Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. 
> Here is the class declaration
> @Validation()
> public class ProfileSearch extends ActionSupport {
> // getter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")	
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)
> 	public String getLast() {
> 		return last;
> 	}
> // Setter
> //	@StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35")
> //	@RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true)
> 	@RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true)	
> 	public void setLast(String last) {
> 		this.last = last;
> 	}
> and jsp snippet
> 		<s:form action="addressSearch!search" method="post" validate="false">
> 			<s:textfield name="first" value="%{first}" label="%{getText('label.first')}" labelposition="left" tabindex="1" maxlength="35" required="true" />
> 			<s:textfield name="last" value="%{last}" label="%{getText('label.last')}" labelposition="left" tabindex="2" maxlength="35" required="true"/>
> I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default.
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.