java - (solved) Tapestry RadioGroup with radio button in loop - Stack Overflow

admin2025-04-15  1

Using tapestry 5.6.2

I want to do something like this

<t:loop t:source="orders" t:value="order">
    <t:RadioGroup name="shipping">

      <t:loop t:source="order.shippingOptions" value="shippingOption">
         <t:Radio value="shippingOption"/>
         <t:Label for="????">${shippingOption.description}<strong>${shippingOption.cost} 
              </strong></t:Label>
      </t:loop>
    </t:RadioGroup>
</t:loop>

The problem is that i can't anticipate which id is the Radio going to take and put it in the "for" parameter of the label

I tried making something like <t:radio id="${shippingOptionId}"...

and implement a "public String getShippingOptionId()" on the java side but that parameter is ignored

Edit: I think i got the solution...

whit this... <t:Radio id="shippingOption" value="shippingOption"/> <t:Label for="shippingOption">

and a valueEncoder i managed to make it work

转载请注明原文地址:http://www.anycun.com/QandA/1744720460a86688.html