You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xianwinwin <xi...@gmail.com> on 2008/01/04 00:37:08 UTC

struts2: interceptor - validation doesn't work :-(

I've been struggling with this issue for a while and any pointer would be
appreciated.

I have a simple file with one field -name; I would like to validate that the
user put information in it.

I'm using the annotation in order to achieve this but for some reason the
validation doesn't work (there's no return message that the user did not
provide the info).

my file looks like this:

 
	@RequiredStringValidator(message="name is missing")
	public void setName(String name)
	{
		this.name=name;
	}


in the jsp page:
...
 <s:textfield name="name" label="your name:" />



in the xml:
        <action name="UserTest_*"  method="{1}"
class="com.simple.validation.Test">
            <result name="error">/pages/error.jsp</result>            
            <result name="success">/pages/welcome.jsp</result>
            
            <interceptor-ref name="guest"/>
        </action>


the guest interceptor is:
            <interceptor-stack name="guest" >
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

any idea?????

-- 
View this message in context: http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by xianwinwin <xi...@gmail.com>.
AND THE WINNER IS:  xniit2003

YES!!!!!! thank you so much! good call and a brilliant observation 

thank you all!

you wrote:
I guess your problem is in the xml file.
You are using "error" result type. But by default if validation error
occurs, "input" string is being returned.
So please use "input" instead of "error" and check again. 
:jumping:
-- 
View this message in context: http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14618918.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by Arpan Debroy <ar...@gmail.com>.
I guess your problem is in the xml file.
You are using "error" result type. But by default if validation error
occurs, "input" string is being returned.
So please use "input" instead of "error" and check again.

Thanks

On Jan 4, 2008 5:07 AM, xianwinwin <xi...@gmail.com> wrote:

>
> I've been struggling with this issue for a while and any pointer would be
> appreciated.
>
> I have a simple file with one field -name; I would like to validate that
> the
> user put information in it.
>
> I'm using the annotation in order to achieve this but for some reason the
> validation doesn't work (there's no return message that the user did not
> provide the info).
>
> my file looks like this:
>
>
>        @RequiredStringValidator(message="name is missing")
>        public void setName(String name)
>        {
>                this.name=name;
>        }
>
>
> in the jsp page:
> ...
>  <s:textfield name="name" label="your name:" />
>
>
>
> in the xml:
>        <action name="UserTest_*"  method="{1}"
> class="com.simple.validation.Test">
>            <result name="error">/pages/error.jsp</result>
>            <result name="success">/pages/welcome.jsp</result>
>
>            <interceptor-ref name="guest"/>
>        </action>
>
>
> the guest interceptor is:
>            <interceptor-stack name="guest" >
>                <interceptor-ref name="defaultStack"/>
>            </interceptor-stack>
>
> any idea?????
>
> --
> View this message in context:
> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Thanks & Regards
 Arpan Debroy

AOL Online India Private Ltd
RMZ EcoSpace Campus 1A
Outer Ring Road, Bellandur,
Bangalore - 560037
India
Mobile No :+9886006306
on-board :+91 (80) 4035 4528
E-mail : arpan.debroy@corp.aol.com

Re: struts2: interceptor - validation doesn't work :-(

Posted by Ian Roughley <ia...@fdar.com>.
I didn't see an INPUT result configured, which will be needed.

/Ian

-- 
Ian Roughley
>From Down & Around, Inc.
Consulting * Training / Mentoring * Agile Process * Open Source
web: http://www.fdar.com - email: ian@fdar.com



Dave Newton wrote:
> Please post the entire relevant code and configuration. I do this all the
> time (annotating the getter, though, as Wes said) and don't have any
> problems. You're extending ActionSupport?
>
> d.
>
> --- xianwinwin <xi...@gmail.com> wrote:
>
>   
>> thanks wes, I tried this manipulation - didnt work
>> :-(
>>
>>
>>
>> Wes Wannemacher wrote:
>>     
>>> Try annotating the getter rather than the setter.
>>>
>>> -Wes
>>>
>>> On 1/3/08, xianwinwin <xi...@gmail.com> wrote:
>>>       
>>>> yes i did :super:
>>>>
>>>>
>>>>
>>>> newton.dave wrote:
>>>>         
>>>>> Did you annotate the class with the @Validation() annotation?
>>>>>
>>>>> d.
>>>>>
>>>>> --- xianwinwin <xi...@gmail.com> wrote:
>>>>>
>>>>>           
>>>>>> I've been struggling with this issue for a while and any pointer
>>>>>>             
>> would
>>     
>>>> be
>>>>         
>>>>>> appreciated.
>>>>>>
>>>>>> I have a simple file with one field -name; I would like to validate
>>>>>>             
>>>> that
>>>>         
>>>>>> the
>>>>>> user put information in it.
>>>>>>
>>>>>> I'm using the annotation in order to achieve this but for some reason
>>>>>>             
>>>> the
>>>>         
>>>>>> validation doesn't work (there's no return message that the user did
>>>>>>             
>>>> not
>>>>         
>>>>>> provide the info).
>>>>>>
>>>>>> my file looks like this:
>>>>>>
>>>>>>
>>>>>>      @RequiredStringValidator(message="name is missing")
>>>>>>      public void setName(String name)
>>>>>>      {
>>>>>>              this.name=name;
>>>>>>      }
>>>>>>
>>>>>>
>>>>>> in the jsp page:
>>>>>> ...
>>>>>>  <s:textfield name="name" label="your name:" />
>>>>>>
>>>>>>
>>>>>>
>>>>>> in the xml:
>>>>>>         <action name="UserTest_*"  method="{1}"
>>>>>> class="com.simple.validation.Test">
>>>>>>             <result name="error">/pages/error.jsp</result>
>>>>>>             <result name="success">/pages/welcome.jsp</result>
>>>>>>
>>>>>>             <interceptor-ref name="guest"/>
>>>>>>         </action>
>>>>>>
>>>>>>
>>>>>> the guest interceptor is:
>>>>>>             <interceptor-stack name="guest" >
>>>>>>                 <interceptor-ref name="defaultStack"/>
>>>>>>             </interceptor-stack>
>>>>>>
>>>>>> any idea?????
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>>>             
> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
>   
>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> --
>>>> View this message in context:
>>>>
>>>>         
> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.html
>   
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>         
>>> -- 
>>> Wesley Wannemacher
>>> President, Head Engineer/Consultant
>>> WanTii, Inc.
>>> http://www.wantii.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>       
>> -- 
>> View this message in context:
>>
>>     
> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14610928.html
>   
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   

Re: struts2: interceptor - validation doesn't work :-(

Posted by Dave Newton <ne...@yahoo.com>.
Please post the entire relevant code and configuration. I do this all the
time (annotating the getter, though, as Wes said) and don't have any
problems. You're extending ActionSupport?

d.

--- xianwinwin <xi...@gmail.com> wrote:

> 
> thanks wes, I tried this manipulation - didnt work
> :-(
> 
> 
> 
> Wes Wannemacher wrote:
> > 
> > Try annotating the getter rather than the setter.
> > 
> > -Wes
> > 
> > On 1/3/08, xianwinwin <xi...@gmail.com> wrote:
> >>
> >> yes i did :super:
> >>
> >>
> >>
> >> newton.dave wrote:
> >> >
> >> > Did you annotate the class with the @Validation() annotation?
> >> >
> >> > d.
> >> >
> >> > --- xianwinwin <xi...@gmail.com> wrote:
> >> >
> >> >>
> >> >> I've been struggling with this issue for a while and any pointer
> would
> >> be
> >> >> appreciated.
> >> >>
> >> >> I have a simple file with one field -name; I would like to validate
> >> that
> >> >> the
> >> >> user put information in it.
> >> >>
> >> >> I'm using the annotation in order to achieve this but for some reason
> >> the
> >> >> validation doesn't work (there's no return message that the user did
> >> not
> >> >> provide the info).
> >> >>
> >> >> my file looks like this:
> >> >>
> >> >>
> >> >>      @RequiredStringValidator(message="name is missing")
> >> >>      public void setName(String name)
> >> >>      {
> >> >>              this.name=name;
> >> >>      }
> >> >>
> >> >>
> >> >> in the jsp page:
> >> >> ...
> >> >>  <s:textfield name="name" label="your name:" />
> >> >>
> >> >>
> >> >>
> >> >> in the xml:
> >> >>         <action name="UserTest_*"  method="{1}"
> >> >> class="com.simple.validation.Test">
> >> >>             <result name="error">/pages/error.jsp</result>
> >> >>             <result name="success">/pages/welcome.jsp</result>
> >> >>
> >> >>             <interceptor-ref name="guest"/>
> >> >>         </action>
> >> >>
> >> >>
> >> >> the guest interceptor is:
> >> >>             <interceptor-stack name="guest" >
> >> >>                 <interceptor-ref name="defaultStack"/>
> >> >>             </interceptor-stack>
> >> >>
> >> >> any idea?????
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> >
> >>
>
http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail: user-help@struts.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
>
http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> > 
> > 
> > -- 
> > Wesley Wannemacher
> > President, Head Engineer/Consultant
> > WanTii, Inc.
> > http://www.wantii.com
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14610928.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by xianwinwin <xi...@gmail.com>.
thanks wes, I tried this manipulation - didnt work
:-(



Wes Wannemacher wrote:
> 
> Try annotating the getter rather than the setter.
> 
> -Wes
> 
> On 1/3/08, xianwinwin <xi...@gmail.com> wrote:
>>
>> yes i did :super:
>>
>>
>>
>> newton.dave wrote:
>> >
>> > Did you annotate the class with the @Validation() annotation?
>> >
>> > d.
>> >
>> > --- xianwinwin <xi...@gmail.com> wrote:
>> >
>> >>
>> >> I've been struggling with this issue for a while and any pointer would
>> be
>> >> appreciated.
>> >>
>> >> I have a simple file with one field -name; I would like to validate
>> that
>> >> the
>> >> user put information in it.
>> >>
>> >> I'm using the annotation in order to achieve this but for some reason
>> the
>> >> validation doesn't work (there's no return message that the user did
>> not
>> >> provide the info).
>> >>
>> >> my file looks like this:
>> >>
>> >>
>> >>      @RequiredStringValidator(message="name is missing")
>> >>      public void setName(String name)
>> >>      {
>> >>              this.name=name;
>> >>      }
>> >>
>> >>
>> >> in the jsp page:
>> >> ...
>> >>  <s:textfield name="name" label="your name:" />
>> >>
>> >>
>> >>
>> >> in the xml:
>> >>         <action name="UserTest_*"  method="{1}"
>> >> class="com.simple.validation.Test">
>> >>             <result name="error">/pages/error.jsp</result>
>> >>             <result name="success">/pages/welcome.jsp</result>
>> >>
>> >>             <interceptor-ref name="guest"/>
>> >>         </action>
>> >>
>> >>
>> >> the guest interceptor is:
>> >>             <interceptor-stack name="guest" >
>> >>                 <interceptor-ref name="defaultStack"/>
>> >>             </interceptor-stack>
>> >>
>> >> any idea?????
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> >
>> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
>> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> Wesley Wannemacher
> President, Head Engineer/Consultant
> WanTii, Inc.
> http://www.wantii.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14610928.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by Wes Wannemacher <we...@wantii.com>.
Try annotating the getter rather than the setter.

-Wes

On 1/3/08, xianwinwin <xi...@gmail.com> wrote:
>
> yes i did :super:
>
>
>
> newton.dave wrote:
> >
> > Did you annotate the class with the @Validation() annotation?
> >
> > d.
> >
> > --- xianwinwin <xi...@gmail.com> wrote:
> >
> >>
> >> I've been struggling with this issue for a while and any pointer would be
> >> appreciated.
> >>
> >> I have a simple file with one field -name; I would like to validate that
> >> the
> >> user put information in it.
> >>
> >> I'm using the annotation in order to achieve this but for some reason the
> >> validation doesn't work (there's no return message that the user did not
> >> provide the info).
> >>
> >> my file looks like this:
> >>
> >>
> >>      @RequiredStringValidator(message="name is missing")
> >>      public void setName(String name)
> >>      {
> >>              this.name=name;
> >>      }
> >>
> >>
> >> in the jsp page:
> >> ...
> >>  <s:textfield name="name" label="your name:" />
> >>
> >>
> >>
> >> in the xml:
> >>         <action name="UserTest_*"  method="{1}"
> >> class="com.simple.validation.Test">
> >>             <result name="error">/pages/error.jsp</result>
> >>             <result name="success">/pages/welcome.jsp</result>
> >>
> >>             <interceptor-ref name="guest"/>
> >>         </action>
> >>
> >>
> >> the guest interceptor is:
> >>             <interceptor-stack name="guest" >
> >>                 <interceptor-ref name="defaultStack"/>
> >>             </interceptor-stack>
> >>
> >> any idea?????
> >>
> >> --
> >> View this message in context:
> >>
> > http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by xianwinwin <xi...@gmail.com>.
yes i did :super:



newton.dave wrote:
> 
> Did you annotate the class with the @Validation() annotation?
> 
> d.
> 
> --- xianwinwin <xi...@gmail.com> wrote:
> 
>> 
>> I've been struggling with this issue for a while and any pointer would be
>> appreciated.
>> 
>> I have a simple file with one field -name; I would like to validate that
>> the
>> user put information in it.
>> 
>> I'm using the annotation in order to achieve this but for some reason the
>> validation doesn't work (there's no return message that the user did not
>> provide the info).
>> 
>> my file looks like this:
>> 
>>  
>> 	@RequiredStringValidator(message="name is missing")
>> 	public void setName(String name)
>> 	{
>> 		this.name=name;
>> 	}
>> 
>> 
>> in the jsp page:
>> ...
>>  <s:textfield name="name" label="your name:" />
>> 
>> 
>> 
>> in the xml:
>>         <action name="UserTest_*"  method="{1}"
>> class="com.simple.validation.Test">
>>             <result name="error">/pages/error.jsp</result>            
>>             <result name="success">/pages/welcome.jsp</result>
>>             
>>             <interceptor-ref name="guest"/>
>>         </action>
>> 
>> 
>> the guest interceptor is:
>>             <interceptor-stack name="guest" >
>>                 <interceptor-ref name="defaultStack"/>
>>             </interceptor-stack>
>> 
>> any idea?????
>> 
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by Randy Burgess <RB...@nuvox.com>.
Don't validation errors go to input? Like so:

     <action name="UserTest_*"  method="{1}"
 class="com.simple.validation.Test">
             <result name="error">/pages/error.jsp</result>
             <result name="input">/pages/welcome-input.jsp</result>
             <result name="success">/pages/welcome.jsp</result>
             <interceptor-ref name="guest"/>
         </action>

I put the annotations on the setters.

@RequiredStringValidator(type = ValidatorType.FIELD, message = "You must
enter a password.")

@StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
minLength = "6", maxLength = "100", fieldName = "pwd", message = "Password
must be at least 6 characters")

public void setPwd(String password) {
        this.pwd = password;
    }

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: xianwinwin <xi...@gmail.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Thu, 3 Jan 2008 15:37:08 -0800 (PST)
> To: <us...@struts.apache.org>
> Subject: struts2: interceptor - validation doesn't work :-(
> 
> 
> I've been struggling with this issue for a while and any pointer would be
> appreciated.
> 
> I have a simple file with one field -name; I would like to validate that the
> user put information in it.
> 
> I'm using the annotation in order to achieve this but for some reason the
> validation doesn't work (there's no return message that the user did not
> provide the info).
> 
> my file looks like this:
> 
>  
> @RequiredStringValidator(message="name is missing")
> public void setName(String name)
> {
> this.name=name;
> }
> 
> 
> in the jsp page:
> ...
>  <s:textfield name="name" label="your name:" />
> 
> 
> 
> in the xml:
>         <action name="UserTest_*"  method="{1}"
> class="com.simple.validation.Test">
>             <result name="error">/pages/error.jsp</result>
>             <result name="success">/pages/welcome.jsp</result>
>             
>             <interceptor-ref name="guest"/>
>         </action>
> 
> 
> the guest interceptor is:
>             <interceptor-stack name="guest" >
>                 <interceptor-ref name="defaultStack"/>
>             </interceptor-stack>
> 
> any idea?????
> 
> -- 
> View this message in context:
> http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%
> 28-tp14607863p14607863.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2: interceptor - validation doesn't work :-(

Posted by Dave Newton <ne...@yahoo.com>.
Did you annotate the class with the @Validation() annotation?

d.

--- xianwinwin <xi...@gmail.com> wrote:

> 
> I've been struggling with this issue for a while and any pointer would be
> appreciated.
> 
> I have a simple file with one field -name; I would like to validate that
> the
> user put information in it.
> 
> I'm using the annotation in order to achieve this but for some reason the
> validation doesn't work (there's no return message that the user did not
> provide the info).
> 
> my file looks like this:
> 
>  
> 	@RequiredStringValidator(message="name is missing")
> 	public void setName(String name)
> 	{
> 		this.name=name;
> 	}
> 
> 
> in the jsp page:
> ...
>  <s:textfield name="name" label="your name:" />
> 
> 
> 
> in the xml:
>         <action name="UserTest_*"  method="{1}"
> class="com.simple.validation.Test">
>             <result name="error">/pages/error.jsp</result>            
>             <result name="success">/pages/welcome.jsp</result>
>             
>             <interceptor-ref name="guest"/>
>         </action>
> 
> 
> the guest interceptor is:
>             <interceptor-stack name="guest" >
>                 <interceptor-ref name="defaultStack"/>
>             </interceptor-stack>
> 
> any idea?????
> 
> -- 
> View this message in context:
>
http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org