client = new Client();
Beaneditform is taking care of that for you. If you want to do it
manually than you have to make sure it gets instantiated.
BTW, I'm just guessing that this is causing your NPE. If you had read
the stacktrace or even used a debugger you would know exactly where the
NPE is occurring.
Uli
Am 23.04.2009 11:28 schrieb kk4Nabble:
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org