Re: [T5.0.18] Setter method was not called when '@Validate' was set.
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.
Re: [T5.0.18] Setter method was not called when '@Validate' was set.
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 - http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> - 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.
Re: [T5.0.18] Setter method was not called when '@Validate' was set.
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.
[T5.0.18] Setter method was not called when '@Validate' was set.
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.