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
---------------------------------
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
    <head>
        <title></title>
    </head>
    <body>
        <form t:type="form" t:clientValidation="false">
               <input t:id="name" t:type="textfield" type="text" />
<input type="submit" value="submit" />
           </form>
    </body>
</html>

---------------------------------

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

Reply via email to