I set up a fresh application from the maven quickstart archetype and added
the sample code posted earlier by osamuo. I also added one sysout to see if
the setter is called.

I cannot confirm that the setter isn't called when @Validate( "required") is
added to the property and you type at least one character into the textfield
and submit the form.

The quickstart archetype uses Tapestry 5.0.18.

On Mon, Feb 23, 2009 at 5:41 PM, Howard Lewis Ship <hls...@gmail.com> wrote:

> I suspect that setName() isn't being called because the input destined
> for the property fails validation.
>
> On Mon, Feb 23, 2009 at 8:35 AM, Robert Zeigler <robe...@scazdl.org>
> wrote:
> > I haven't tested this behavior, but I would consider it a bug for two
> > reasons:
> > 1) write = false is specified for @Property.  So tapestry really
> shouldn't
> > be creating any setters for this property during the class
> transformation.
> > 2) From Osamuo's text, it sounds like that if you don't have @Validate,
> the
> > custom setter is called just fine.  It's only when you add @Validate that
> > the set fails.  Is that the case?
> > If so, it's definitely a bug.  It either needs to fail in both cases, or
> > succeed in both cases.
> >
> > Robert
> >
> > On Feb 23, 2009, at 2/236:05 AM , Ulrich Stärk wrote:
> >
> >> No, it's not. This is expected behaviour.
> >>
> >> Uli
> >>
> >> inyokoyoko-deve...@yahoo.co.jp schrieb:
> >>>
> >>> Hi,
> >>> I have already known a solution.
> >>> It seems to be a bug.
> >>> Don't you think so?
> >>> osamuo
> >>> Using the @Property annotation will make Tapestry add getters and
> setters
> >>> for this property during class transformation that will override your
> >>> supplied ones. Leave out the @Property annotation and specify your own
> >>> getters and setters and you should be fine.
> >>> Uli
> >>> inyokoyoko-deve...@yahoo.co.jp schrieb:
> >>>>
> >>>> Hi,
> >>>>
> >>>> You can encounter the same problem with the following code in a
> freshly
> >>>> set up project. Please try. Click the submit button.
> >>>>
> >>>>
> >>>> Test.java
> >>>> ---------------------------------
> >>>> package org.example.myapp.pages;
> >>>>
> >>>> import java.util.Date;
> >>>>
> >>>> import org.apache.tapestry5.annotations.Property;
> >>>> import org.apache.tapestry5.beaneditor.Validate;
> >>>>
> >>>>
> >>>> public class Test{
> >>>>
> >>>>   @Property( write = false )
> >>>>   @Validate( "required") // <== when this line is added, setName() is
> >>>> not called
> >>>>   private String name;
> >>>>     public void setName( String name ){
> >>>>   this.name = name;
> >>>>  }
> >>>> }
> >>>> ---------------------------------
> >>>>
> >>>>
> >>>> Test.tml
> >>>> ---------------------------------
> >>>>
> >>>>                                           [input]
> >>>>          [input]
> >>>>
> >>>> ---------------------------------
> >>>>
> >>>> osamuo
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> I'm using the same version as you do - 5.0.18
> >>>> Have you tried the same code in a freshly set up project? The problem
> >>>> seems
> >>>> to be somewhere else in your project.
> >>>>
> >>>> On Sun, Feb 22, 2009 at 5:55 PM,  wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> What version are you using?
> >>>>>
> >>>>> With the following code setName() was called.
> >>>>>
> >>>>> @Property( write = false )
> >>>>> private String name;
> >>>>> public void setName( String name ){     <== called
> >>>>>  ...
> >>>>>  this.name = ....
> >>>>> }
> >>>>>
> >>>>>
> >>>>>
> >>>>> With the following code setName() was not called.
> >>>>>
> >>>>> @Property( write = false )
> >>>>> @Validate( "Required,MinLength=5,MaxLength=16" )
> >>>>> private String name;
> >>>>> public void setName( String name ){      <== not called
> >>>>>  ...
> >>>>>  this.name = ....
> >>>>> }
> >>>>>
> >>>>>
> >>>>> I don't know why the setter is not called if I add @Validate.
> >>>>>
> >>>>>
> >>>>> osamuo
> >>>>>
> >>>>>
> >>>>> Markus Lux  wrote: With your example code I'm
> >>>>> getting an ComponentEventException saying that
> >>>>> "name" is read-only.
> >>>>> Try adding a public-modifier to your setter. That worked for me.
> >>>>>
> >>>>> On Sun, Feb 22, 2009 at 3:49 PM,  wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> When I set '@Validate' for a TextField, the setter was never called.
> >>>>>> It seems to be a bug.
> >>>>>>
> >>>>>> @Property( write = false )
> >>>>>> @Validate( "Required,MinLength=5,MaxLength=16" )
> >>>>>> private String name;
> >>>>>> void setName( String name ){      <=== not called
> >>>>>>  ...
> >>>>>>  this.name = ....
> >>>>>> }
> >>>>>>
> >>>>>> Thanks,
> >>>>>> osamuo
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> ---------------------------------
> >>>>>> Power up the Internet with Yahoo! Toolbar.
> >>>>>>
> >>>>>
> >>>>>
> >>>>> ---------------------------------
> >>>>> Power up the Internet with Yahoo! Toolbar.
> >>>>>
> >>>>
> >>>> ---------------------------------
> >>>> Power up the Internet with Yahoo! Toolbar.
> >>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>>  ---------------------------------
> >>> Power up the Internet with Yahoo! Toolbar.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to