Login.java:

public class Login {

  // Credentials is a simple POJO with two
  // properties, username and password
  private Credentials credentials = new Credentials();

  /* lots of other stuff */
}

Login.html:

[header stuff]
  <t:form>
    <t:errors/>

    <t:textfield t:id="username" t:value="credentials.username"/>
    <t:passwordfield t:id="password" t:value="credentials.password"/>
    <input type="submit" value="Login"/>
  </t:form>
[footer stuff]

Renders as (minus the validation stuff etc.):

[header stuff]
  <form>
    <input id="username" name="username" type="text" value="">
    <input id="password" name="password" type="password" value="">
    <input type="submit" value="Login">
  </form>
[footer stuff]

The important thing is that Tapestry knows that the field username is connected to the property credentials.username, and that the field password is connected to the property credentials.password. But you don't have to worry about that.

smithfox skrev:
I'm sure that I have getter and setter for price.
Could you show me your code. Thanks


Filip S. Adamsen-2 wrote:
Make sure you've declared a getter and setter for price in your Product class. The output you're seeing is expected and works for me in a similar case.

smithfox skrev:
Yes, I tried earlier

<form t:type="form">
<input t:type="TextField" t:value="sale.product.price"/>
<input type="submit" value="submit"/>
</form>

After render, the html is :
<input id="textfield" name="textfield" type="text" value="12">
Obviously, when i submit, occur exception beacuse my page class has no
textfield field.



Filip S. Adamsen-2 wrote:
Yeah, then you definitely need to set the VALUE to sale.product.price, not the id. Just listen to Nick, he knows what he's talking about. : )

smithfox skrev:
It's a edit form.

Nick Westgate wrote:
Why are you binding the id to that? Don't you mean
t:value="sale.product.price"?

Cheers,
Nick.

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



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





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

Reply via email to