Em Wed, 08 Oct 2008 16:26:30 -0300, Keith Bottner <[EMAIL PROTECTED]> escreveu:

Do you have an example of this working. I have been going around and around and have not been able to get this to work, so I was hoping there was some code you wouldn't mind sharing that demonstrates this working.

I've just wrote and tested this example. The User class is the one from Generic Authentication (www.arsmachina.com.br/project/genericauthentication) and it is a simple Java class.

public class UserChooser {

// the prefix must be PROP, because it (prefix) must be read-write for this to work.
        @Parameter(defaultPrefix = BindingConstants.PROP)
        @Property
        @SuppressWarnings("unused")
        private User user;

        @Inject
        private SelectModelFactory selectModelFactory;

        public SelectModel getModel() {
                return ...;
        }

}

UserChooser.tml:
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
        <select t:type="Select" t:model="model" t:value="user">
        </select>
</t:container>

TestPage.java:

@Property
private User user;

@OnEvent(component = "testForm", value = Form.SUCCESS)
public void test() {
        System.out.println(user.getName());
}

TestPage.tml:

<form t:type="Form" t:id="testForm">
                
        <label for="user">User</label>
        <select t:type="UserChooser" t:id="user" t:user="user"/>
        <br />
                        
        <input type="submit"/>
                
</form>

I hope it helps. :)

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to