Thank your very much.
I test your code. It can pass.

But my case is different with yours.
Your business object is a simple POJO class.
But if you add another business class to the simple POJO class as a field,
the tapestry doesn't recognise it.

"sale.date" can pass, 
But "sale.product.price" can't pass.

You can do a test.


Filip S. Adamsen-2 wrote:
> 
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-How-to-bind-composite-class%27-field%28like-sale.product.price%29-in-page-template-tf4395512.html#a12554977
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to