You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jason Douglas de Oliveira (JIRA)" <ji...@apache.org> on 2007/11/04 14:49:34 UTC

[jira] Created: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Validation occurs without need the @Validation annotation with Zero Configuration
---------------------------------------------------------------------------------

                 Key: WW-2292
                 URL: https://issues.apache.org/struts/browse/WW-2292
             Project: Struts 2
          Issue Type: Bug
          Components: Core Actions
    Affects Versions: 2.0.11, 2.0.9
         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
            Reporter: Jason Douglas de Oliveira


When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
I try too with @VisitorFieldValidator and the same behavior happen.

-- 
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-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Posted by "Jason Douglas de Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42580 ] 

jasondouglas77@gmail.com edited comment on WW-2292 at 11/6/07 2:45 PM:
------------------------------------------------------------------------

I don't want to skip the validation. Why I need the @Validation if the annotation related with validation already turn on the validation mechanism?

the example is wrong?
Why I put an instruction where the bevariour already expected? like:

public class Customer{

   public Customer(){ <-- WHY? I DON'T NEED
      super(); <-- WHY? I DON'T NEED
   } 
}

So the example must show a case where the @Validation is really required, not?

      was (Author: jasondouglas77@gmail.com):
    I don't want to skip the validation. Why I need the @Validation if the annotation related with validation already turn on the validation mechanism?

the example is wrong?
Why I put an instruction where the bevariour already expected? like:

public class Customer{

   public Customer(){ <-- WHY? I NEED
      super(); <-- WHY? I NEED
   } 
}

So the example must show a case where the @Validation is really required, not?
  
> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>             Fix For: 2.1.4
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Commented: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

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

Dave Newton commented on WW-2292:
---------------------------------

Does your action subclass ActionSupport?

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Assigned: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

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

Don Brown reassigned WW-2292:
-----------------------------

    Assignee: Don Brown

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>            Assignee: Don Brown
>             Fix For: 2.1.3
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Resolved: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

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

Don Brown resolved WW-2292.
---------------------------

    Resolution: Fixed

Yep, this is no longer necessary.  I, therefore, marked the annotation as deprecated.

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>            Assignee: Don Brown
>             Fix For: 2.1.3
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Commented: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Posted by "Jason Douglas de Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42580 ] 

Jason Douglas de Oliveira commented on WW-2292:
-----------------------------------------------

I don't want to skip the validation. Why I need the @Validation if the annotation related with validation already turn on the validation mechanism?

the example is wrong?
Why I put an instruction where the bevariour already expected? like:

public class Customer{

   public Customer(){ <-- WHY? I NEED
      super(); <-- WHY? I NEED
   } 
}

So the example must show a case where the @Validation is really required, not?

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>             Fix For: 2.1.4
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

-- 
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-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Posted by "Jason Douglas de Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42575 ] 

jasondouglas77@gmail.com edited comment on WW-2292 at 11/6/07 4:23 AM:
------------------------------------------------------------------------

Yes. I extend the ActionSupport like the annotation sample 
http://struts.apache.org/2.0.11/docs/validation-annotation.html
Below the class

package com.jdo.actions.customer;

import org.apache.struts2.config.Namespace;
import org.apache.struts2.config.Result;
import org.apache.struts2.config.Results;
import org.apache.struts2.dispatcher.ServletDispatcherResult;
import org.apache.struts2.dispatcher.ServletRedirectResult;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.validator.annotations.EmailValidator;
import com.opensymphony.xwork2.validator.annotations.IntRangeFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator;

@Namespace("/register")
@Results({
	@Result(name="success", value="/jsp/success.jsp", type=ServletRedirectResult.class),
	@Result(name="input", value="/jsp/customer.jsp", type=ServletDispatcherResult.class),
	@Result(name="error", value="/jsp/error.jsp", type=ServletRedirectResult.class)
})
public class CreateAction extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = -2661899805487898664L;
	
	private String name;
	private Integer age;
	private String email;
	
	@RequiredStringValidator(trim=true, message="The name is required")
	@StringLengthFieldValidator(minLength="2", maxLength="10", message="The name length must be between ${mixLength} and ${maxLength}")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@RequiredFieldValidator(message="The age is required")
	@IntRangeFieldValidator(min="0", max="2147483647", message="The age must be an integer")
	public Integer getAge() {
		return age;
	}
	public void setAge(Integer age) {
		this.age = age;
	}

	@RequiredStringValidator(trim=true, message="The email is required")
	@EmailValidator(message="The email is invalid")
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	
	public String execute() throws Exception{
		return "success";
	}
	
	
} 

      was (Author: jasondouglas77@gmail.com):
    Yes.
  
> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Commented: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Posted by "Brad Cupit (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44103#action_44103 ] 

Brad Cupit commented on WW-2292:
--------------------------------

I actually like this "bug", or maybe I should call it a feature  :-)

I suppose if this is the desired functionality (meaning, don't require @Validation at the class level) then I suppose this bug could be changed to "documentation of @Validation is incorrect".

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>             Fix For: 2.1.4
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Commented: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44189#action_44189 ] 

Don Brown commented on WW-2292:
-------------------------------

Yeah, this is bizarre.  The @Validation annotation is basically worthless, as the class and methods are scanned for validation annotations regardless.  The only way it is used is as a way to collect @Validations instances, which is dubious really.  I'm gonna leave it open for Rene or Rainer to comment, but it seems like we should at least deprecate it and better explain its real purpose (or lack thereof)

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>             Fix For: 2.1.3
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Updated: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

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

Don Brown updated WW-2292:
--------------------------

    Fix Version/s:     (was: 2.1.4)
                   2.1.3

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>             Fix For: 2.1.3
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Commented: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

Posted by "Jason Douglas de Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42575 ] 

Jason Douglas de Oliveira commented on WW-2292:
-----------------------------------------------

Yes.

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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


[jira] Commented: (WW-2292) Validation occurs without need the @Validation annotation with Zero Configuration

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

Dave Newton commented on WW-2292:
---------------------------------

This is (apparently) the expected behavior if subclassing ActionSupport, although I understand the confusion.

"There's another semantic, @SkipValidation, that is intended to suppress inherited validations. (Though, it may still not work quite right.)"

There are also a few ways to skip validation based on what method is being executed (the validation interceptor is a MethodFilterInterceptor subclass, for example).

> Validation occurs without need the @Validation annotation with Zero Configuration
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2292
>                 URL: https://issues.apache.org/struts/browse/WW-2292
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9, 2.0.11
>         Environment: Windows XP 2600.xpsp_sp2_rtm.040803-2158 (SP2). Tomcat 6.0.14
>            Reporter: Jason Douglas de Oliveira
>             Fix For: 2.1.4
>
>
> When the action class has some annotation related with validation like: @RequiredStringValidator, @StringLengthFieldValidator, @RequiredFieldValidator, etc. The action is validate without need the @Validation annotation.
> I try too with @VisitorFieldValidator and the same behavior happen.

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