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/06/19 03:34:06 UTC

S2: validation notation on DATE (object that has a Date field)

I was wondering how to force the user to input a Date field? consider the a
class of Employee (dob, name).
and I wish to insert new data. 

I managed to force the date by the code below, but couldn't do that for the
date. 

example
Class Test {

   private Employee empl;

    
    @Validations(
           stringLengthFields ={
 @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
minLength="1" , fieldName = "empl.name", 	message = "required field")

            					}
    )  
   public String insertEmpl()
   {
         //do something here only if both DOB and NAME are not null (or size
0)

    }


    //getter setter here

}

thank you!!!!

-- 
View this message in context: http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p17995565.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: S2: validation notation on DATE (object that has a Date field)

Posted by Jim Kiley <jh...@summa-tech.com>.
Have you set the validateAnnotatedMethodOnly property on the validation
interceptor in your struts.xml? (
http://struts.apache.org/2.0.11.1/docs/validations-annotation.html)

On Tue, Jun 24, 2008 at 10:21 AM, xianwinwin <xi...@gmail.com> wrote:

>
> I tried to do something with RequiredFieldValidator,
>
>    @Validations(
>            stringLengthFields ={@StringLengthFieldValidator(type =
> ValidatorType.SIMPLE, trim = true, minLength="1" , fieldName = "empl.name
> ",
> message = "required field")},
>            requiredFields =    {@RequiredFieldValidator(type =
> ValidatorType.SIMPLE, fieldName = "empl.dob", message = "dob - required
> field")}
>    )
>    public String insertEmpl()
>    {
>          //do something here only if both DOB and NAME are not null (or
> size 0)
>
>     }
>
> but it didn't work out.
>
>
>
>
>
> Jim Kiley wrote:
> >
> > Fair enough.  Is this something you could solve with a validate() method
> > on
> > your action, assuming that your action is ValidationAware?
> >
> > On Tue, Jun 24, 2008 at 9:45 AM, xianwinwin <xi...@gmail.com>
> wrote:
> >
> >>
> >> But that means that ALL objects type Empl will have a mandatory field
> >> called
> >> DOB. I wish to have more flexibility by  choosing the mandatory field
> >> based
> >> on the user's action.
> >>
> >>
> >>
> >> Jim Kiley wrote:
> >> >
> >> > If "empl" is a field on your action, and your JSP references the field
> >> as
> >> > "empl.date," put the validation on the setter for the date field of
> >> Empl,
> >> > rather than on the action.
> >> >
> >> > On Tue, Jun 24, 2008 at 9:06 AM, xianwinwin <xi...@gmail.com>
> >> wrote:
> >> >
> >> >>
> >> >> hi Lukasz
> >> >>
> >> >> In your example, you wrote:
> >> >>
> >> >> Private Date today;
> >> >>
> >> >>    @RequiredFieldValidator(message = "Date is required")
> >> >>    public Date getToday() {
> >> >>        return today;
> >> >>    }
> >> >>
> >> >> this works great also in my application, but my question is
> different,
> >> I
> >> >> don't have a field called today, I have an object name Empl (that has
> >> a
> >> >> field date)
> >> >>
> >> >> so I have:
> >> >>
> >> >> public Empl getEmpl()
> >> >> {
> >> >>
> >> >>
> >> >> }
> >> >>
> >> >> in my action: insertEmpl()
> >> >> I would like to make sure that DOB (Date Of Birth) was input by the
> >> user.
> >> >> This, I still didn't figure out how to do.
> >> >>
> >> >> The configuration that I have is this:
> >> >>
> >> >>
> >> >>    @Validations(
> >> >>           stringLengthFields ={
> >> >>  @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim =
> true,
> >> >> minLength="1" , fieldName = "empl.name", message = "required field")
> >> >>
> >> >>            }
> >> >>    )
> >> >>   public String insertEmpl()
> >> >>   {
> >> >>         //do something here only if both DOB and NAME are not null
> (or
> >> >> size
> >> >> 0)
> >> >>
> >> >>    }
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> Lukasz Lenart wrote:
> >> >> >
> >> >> > Hi,
> >> >> >
> >> >> >> This also works on my end *BUT* the Date in part of an Object (not
> >> a
> >> >> >> field)
> >> >> >
> >> >> > Could you show your configuration?
> >> >> >
> >> >> >
> >> >> > Regards
> >> >> > --
> >> >> > Lukasz
> >> >> > http://www.lenart.org.pl/
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18090595.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
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Jim Kiley
> >> > Technical Consultant | Summa
> >> > [p] 412.258.3346 [m] 412.445.1729
> >> > http://www.summa-tech.com
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18091357.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
> >>
> >>
> >
> >
> > --
> > Jim Kiley
> > Technical Consultant | Summa
> > [p] 412.258.3346 [m] 412.445.1729
> > http://www.summa-tech.com
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18092117.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
>
>


-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

Re: S2: validation notation on DATE (object that has a Date field)

Posted by xianwinwin <xi...@gmail.com>.
I tried to do something with RequiredFieldValidator,

    @Validations(
            stringLengthFields ={@StringLengthFieldValidator(type =
ValidatorType.SIMPLE, trim = true, minLength="1" , fieldName = "empl.name",
message = "required field")},
            requiredFields =  	{@RequiredFieldValidator(type =
ValidatorType.SIMPLE, fieldName = "empl.dob", message = "dob - required
field")}
    )  
    public String insertEmpl()
    {
          //do something here only if both DOB and NAME are not null (or
size 0)
    	 
     } 

but it didn't work out. 





Jim Kiley wrote:
> 
> Fair enough.  Is this something you could solve with a validate() method
> on
> your action, assuming that your action is ValidationAware?
> 
> On Tue, Jun 24, 2008 at 9:45 AM, xianwinwin <xi...@gmail.com> wrote:
> 
>>
>> But that means that ALL objects type Empl will have a mandatory field
>> called
>> DOB. I wish to have more flexibility by  choosing the mandatory field
>> based
>> on the user's action.
>>
>>
>>
>> Jim Kiley wrote:
>> >
>> > If "empl" is a field on your action, and your JSP references the field
>> as
>> > "empl.date," put the validation on the setter for the date field of
>> Empl,
>> > rather than on the action.
>> >
>> > On Tue, Jun 24, 2008 at 9:06 AM, xianwinwin <xi...@gmail.com>
>> wrote:
>> >
>> >>
>> >> hi Lukasz
>> >>
>> >> In your example, you wrote:
>> >>
>> >> Private Date today;
>> >>
>> >>    @RequiredFieldValidator(message = "Date is required")
>> >>    public Date getToday() {
>> >>        return today;
>> >>    }
>> >>
>> >> this works great also in my application, but my question is different,
>> I
>> >> don't have a field called today, I have an object name Empl (that has
>> a
>> >> field date)
>> >>
>> >> so I have:
>> >>
>> >> public Empl getEmpl()
>> >> {
>> >>
>> >>
>> >> }
>> >>
>> >> in my action: insertEmpl()
>> >> I would like to make sure that DOB (Date Of Birth) was input by the
>> user.
>> >> This, I still didn't figure out how to do.
>> >>
>> >> The configuration that I have is this:
>> >>
>> >>
>> >>    @Validations(
>> >>           stringLengthFields ={
>> >>  @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
>> >> minLength="1" , fieldName = "empl.name", message = "required field")
>> >>
>> >>            }
>> >>    )
>> >>   public String insertEmpl()
>> >>   {
>> >>         //do something here only if both DOB and NAME are not null (or
>> >> size
>> >> 0)
>> >>
>> >>    }
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Lukasz Lenart wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> >> This also works on my end *BUT* the Date in part of an Object (not
>> a
>> >> >> field)
>> >> >
>> >> > Could you show your configuration?
>> >> >
>> >> >
>> >> > Regards
>> >> > --
>> >> > Lukasz
>> >> > http://www.lenart.org.pl/
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18090595.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
>> >>
>> >>
>> >
>> >
>> > --
>> > Jim Kiley
>> > Technical Consultant | Summa
>> > [p] 412.258.3346 [m] 412.445.1729
>> > http://www.summa-tech.com
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18091357.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
>>
>>
> 
> 
> -- 
> Jim Kiley
> Technical Consultant | Summa
> [p] 412.258.3346 [m] 412.445.1729
> http://www.summa-tech.com
> 
> 

-- 
View this message in context: http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18092117.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: S2: validation notation on DATE (object that has a Date field)

Posted by Jim Kiley <jh...@summa-tech.com>.
Fair enough.  Is this something you could solve with a validate() method on
your action, assuming that your action is ValidationAware?

On Tue, Jun 24, 2008 at 9:45 AM, xianwinwin <xi...@gmail.com> wrote:

>
> But that means that ALL objects type Empl will have a mandatory field
> called
> DOB. I wish to have more flexibility by  choosing the mandatory field based
> on the user's action.
>
>
>
> Jim Kiley wrote:
> >
> > If "empl" is a field on your action, and your JSP references the field as
> > "empl.date," put the validation on the setter for the date field of Empl,
> > rather than on the action.
> >
> > On Tue, Jun 24, 2008 at 9:06 AM, xianwinwin <xi...@gmail.com>
> wrote:
> >
> >>
> >> hi Lukasz
> >>
> >> In your example, you wrote:
> >>
> >> Private Date today;
> >>
> >>    @RequiredFieldValidator(message = "Date is required")
> >>    public Date getToday() {
> >>        return today;
> >>    }
> >>
> >> this works great also in my application, but my question is different, I
> >> don't have a field called today, I have an object name Empl (that has a
> >> field date)
> >>
> >> so I have:
> >>
> >> public Empl getEmpl()
> >> {
> >>
> >>
> >> }
> >>
> >> in my action: insertEmpl()
> >> I would like to make sure that DOB (Date Of Birth) was input by the
> user.
> >> This, I still didn't figure out how to do.
> >>
> >> The configuration that I have is this:
> >>
> >>
> >>    @Validations(
> >>           stringLengthFields ={
> >>  @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
> >> minLength="1" , fieldName = "empl.name", message = "required field")
> >>
> >>            }
> >>    )
> >>   public String insertEmpl()
> >>   {
> >>         //do something here only if both DOB and NAME are not null (or
> >> size
> >> 0)
> >>
> >>    }
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> Lukasz Lenart wrote:
> >> >
> >> > Hi,
> >> >
> >> >> This also works on my end *BUT* the Date in part of an Object (not a
> >> >> field)
> >> >
> >> > Could you show your configuration?
> >> >
> >> >
> >> > Regards
> >> > --
> >> > Lukasz
> >> > http://www.lenart.org.pl/
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18090595.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
> >>
> >>
> >
> >
> > --
> > Jim Kiley
> > Technical Consultant | Summa
> > [p] 412.258.3346 [m] 412.445.1729
> > http://www.summa-tech.com
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18091357.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
>
>


-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

Re: S2: validation notation on DATE (object that has a Date field)

Posted by xianwinwin <xi...@gmail.com>.
But that means that ALL objects type Empl will have a mandatory field called
DOB. I wish to have more flexibility by  choosing the mandatory field based
on the user's action. 



Jim Kiley wrote:
> 
> If "empl" is a field on your action, and your JSP references the field as
> "empl.date," put the validation on the setter for the date field of Empl,
> rather than on the action.
> 
> On Tue, Jun 24, 2008 at 9:06 AM, xianwinwin <xi...@gmail.com> wrote:
> 
>>
>> hi Lukasz
>>
>> In your example, you wrote:
>>
>> Private Date today;
>>
>>    @RequiredFieldValidator(message = "Date is required")
>>    public Date getToday() {
>>        return today;
>>    }
>>
>> this works great also in my application, but my question is different, I
>> don't have a field called today, I have an object name Empl (that has a
>> field date)
>>
>> so I have:
>>
>> public Empl getEmpl()
>> {
>>
>>
>> }
>>
>> in my action: insertEmpl()
>> I would like to make sure that DOB (Date Of Birth) was input by the user.
>> This, I still didn't figure out how to do.
>>
>> The configuration that I have is this:
>>
>>
>>    @Validations(
>>           stringLengthFields ={
>>  @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
>> minLength="1" , fieldName = "empl.name", message = "required field")
>>
>>            }
>>    )
>>   public String insertEmpl()
>>   {
>>         //do something here only if both DOB and NAME are not null (or
>> size
>> 0)
>>
>>    }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Lukasz Lenart wrote:
>> >
>> > Hi,
>> >
>> >> This also works on my end *BUT* the Date in part of an Object (not a
>> >> field)
>> >
>> > Could you show your configuration?
>> >
>> >
>> > Regards
>> > --
>> > Lukasz
>> > http://www.lenart.org.pl/
>> >
>> > ---------------------------------------------------------------------
>> > 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18090595.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
>>
>>
> 
> 
> -- 
> Jim Kiley
> Technical Consultant | Summa
> [p] 412.258.3346 [m] 412.445.1729
> http://www.summa-tech.com
> 
> 

-- 
View this message in context: http://www.nabble.com/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18091357.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: S2: validation notation on DATE (object that has a Date field)

Posted by Jim Kiley <jh...@summa-tech.com>.
If "empl" is a field on your action, and your JSP references the field as
"empl.date," put the validation on the setter for the date field of Empl,
rather than on the action.

On Tue, Jun 24, 2008 at 9:06 AM, xianwinwin <xi...@gmail.com> wrote:

>
> hi Lukasz
>
> In your example, you wrote:
>
> Private Date today;
>
>    @RequiredFieldValidator(message = "Date is required")
>    public Date getToday() {
>        return today;
>    }
>
> this works great also in my application, but my question is different, I
> don't have a field called today, I have an object name Empl (that has a
> field date)
>
> so I have:
>
> public Empl getEmpl()
> {
>
>
> }
>
> in my action: insertEmpl()
> I would like to make sure that DOB (Date Of Birth) was input by the user.
> This, I still didn't figure out how to do.
>
> The configuration that I have is this:
>
>
>    @Validations(
>           stringLengthFields ={
>  @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
> minLength="1" , fieldName = "empl.name", message = "required field")
>
>            }
>    )
>   public String insertEmpl()
>   {
>         //do something here only if both DOB and NAME are not null (or size
> 0)
>
>    }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Lukasz Lenart wrote:
> >
> > Hi,
> >
> >> This also works on my end *BUT* the Date in part of an Object (not a
> >> field)
> >
> > Could you show your configuration?
> >
> >
> > Regards
> > --
> > Lukasz
> > http://www.lenart.org.pl/
> >
> > ---------------------------------------------------------------------
> > 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18090595.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
>
>


-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

Re: S2: validation notation on DATE (object that has a Date field)

Posted by xianwinwin <xi...@gmail.com>.
hi Lukasz 

In your example, you wrote:

Private Date today;

    @RequiredFieldValidator(message = "Date is required")
    public Date getToday() {
        return today;
    } 

this works great also in my application, but my question is different, I
don't have a field called today, I have an object name Empl (that has a
field date)

so I have:

public Empl getEmpl()
{


}

in my action: insertEmpl() 
I would like to make sure that DOB (Date Of Birth) was input by the user.
This, I still didn't figure out how to do. 

The configuration that I have is this:

   
    @Validations(
           stringLengthFields ={
 @StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
minLength="1" , fieldName = "empl.name", message = "required field")

            }
    )  
   public String insertEmpl()
   {
         //do something here only if both DOB and NAME are not null (or size
0)

    }















Lukasz Lenart wrote:
> 
> Hi,
> 
>> This also works on my end *BUT* the Date in part of an Object (not a
>> field)
> 
> Could you show your configuration?
> 
> 
> Regards
> -- 
> Lukasz
> http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18090595.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: S2: validation notation on DATE (object that has a Date field)

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,

> This also works on my end *BUT* the Date in part of an Object (not a field)

Could you show your configuration?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: S2: validation notation on DATE (object that has a Date field)

Posted by xianwinwin <xi...@gmail.com>.
This also works on my end *BUT* the Date in part of an Object (not a field) 

so I have Employee empl; 
with Date dob,

thank you




Lukasz Lenart wrote:
> 
>> I did, and it doesn't work, when I click submit, I immediately get a red
>> message next to the required fields...but not next to the date.
> 
> That strange, I made a test and it works, I've annotated at setter level
> 
>     @RequiredFieldValidator(message = "Date is required")
>     public Date getToday() {
>         return today;
>     }
> 
>     public void setToday(Date today) {
>         this.today = today;
>     }
> 
> 
> <s:textfield label="Today" name="today" />
> 
> 
> Regards
> -- 
> Lukasz
> http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18080445.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: S2: validation notation on DATE (object that has a Date field)

Posted by Lukasz Lenart <lu...@googlemail.com>.
> I did, and it doesn't work, when I click submit, I immediately get a red
> message next to the required fields...but not next to the date.

That strange, I made a test and it works, I've annotated at setter level

    @RequiredFieldValidator(message = "Date is required")
    public Date getToday() {
        return today;
    }

    public void setToday(Date today) {
        this.today = today;
    }


<s:textfield label="Today" name="today" />


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: S2: validation notation on DATE (object that has a Date field)

Posted by xianwinwin <xi...@gmail.com>.
I did, and it doesn't work, when I click submit, I immediately get a red
message next to the required fields...but not next to the date. 



Lukasz Lenart wrote:
> 
> Hi,
> 
> Did you try
> @RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName =
> "customfield", message = "You must enter a value for field.")
> ?
> 
> 
> Regards
> -- 
> Lukasz
> http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> 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/S2%3A-validation-notation-on-DATE-%28object-that-has-a-Date-field%29-tp17995565p18009730.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: S2: validation notation on DATE (object that has a Date field)

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,

Did you try
@RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName =
"customfield", message = "You must enter a value for field.")
?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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