your client field is null!!



kk4Nabble <kavya....@gmail.com> 
23.04.2009 11:28
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
users@tapestry.apache.org
Kopie

Thema
Re: How to pass data from page(tml) to java class








HI,

It workes for beaneditform perfectly fine.
 Thats  when i give like this.

 <t:beaneditform submitlabel="Create " object="client"/>

But not for the usual form .

I even tried
t:value="client.firstName".
But it does not work.




Ulrich Stärk wrote:
> 
> Your client object is probably null. Make sure it isn't.
> 
> Uli
> 
> Am 23.04.2009 11:14 schrieb kk4Nabble:
>> 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..
>> 
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-pass-data-from-page%28tml%29-to-java-class-tp23193236p23193415.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