Hi all,

Am learning Tapestry 5.

This is createclient.tml

<form t:type="form" t:id="names" >
                <t:errors/>
                <table>
                        <tr>
                                <td>First Name:</td>
                                <td><input t:type="TextField" t:id="firstName"
t:value="firstName"/></td>
                        </tr>
                        <tr>
                                <td>Last Name:</td>
                                <td><input t:type="TextField" t:id="lastName" 
t:value="lastName"/></td>
                        </tr>
                        <tr>
                                <td></td>
                                <td><input type="submit" value="Save"/></td>
                        </tr>
                </table>
        </form>

And createclient.java

public class CreateClient
{

        @Property
        private String firstName;

        @Property
        private String lastName;

        @Component(id = "names")
        private Form form;
   
        
        @Component(id = "firstName")
        private TextField firstNameField;

        @Component(id = "lastName")
        private TextField lastNameField;
        
        
    @Property
    private Client client;

    @Inject
    private Session session;

    @InjectPage
    private Index index;



        @CommitAfter
    Object onSuccess()
    {
        client.setFirstName(firstName);
        client.setLastName(lastName);
        session.persist(client);

        return index;
    }
}       

I have an entity class Client with first name and lastname.

If i don use beaneditform And want to use this form and still store the
value of client in database.

The above method gives null pointer exception .

How  do i do that?

Did i miss anything?

Can anyone help me..

Thanks in advance..


 
-- 
View this message in context: 
http://www.nabble.com/How-to-pass-data-from-page%28tml%29-to-java-class-tp23193236p23193236.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to