挂毯广播组

时间:2011-01-19 18:03:48

标签: tapestry

我无法让tapestry 4电台工作。

我的HTML

<td><span jwcid="activeServerRadioGroup"></span></td>
<td><input type="radio" jwcid="activeServerRadio" /></td>

我的.page

<property name="activeServer"/> 
<component id="activeServerRadioGroup" type="RadioGroup">
         <binding name="selected" value="activeServer.selected"/>
</component>
<component id="activeServers" type="For">
     <binding name="source" value="activeServers"/>
     <binding name="keyExpression" value="literal:id"/>
     <binding name="value" value="activeServer"/>
     <binding name="element" value="literal:tr"/>
</component>
<component id="activeServerRadio" type="Radio">
      <binding name="value" value="activeServer.id"/>
</component> 

在我的.java文件中 我有一个getActiveServers()方法,它返回一个带有selected,id属性的自定义类列表。上述结构不起作用。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

你没有详细描述你的问题,但这是我的猜测:

1。无线电必须放在RadioGroup

<span jwcid="activeServerRadioGroup">
  <tr jwcid="activeServers">
    <td><input type="radio" jwcid="activeServerRadio" /></td>
  </tr>
</span>

2。 RadioGroup的“selected”参数必须设置为服务器ID

<component id="activeServerRadioGroup" type="RadioGroup">
  <binding name="selected" value="activeServerId"/>
</component>

在您的网页课程中:

public ... getActiveServerId()
{
  // Return the id of the active server
}

3。也许你甚至不应该使用RadioGroup?

RadioGroup仅用于从列表中选择一个对象。从您的描述中可以看出,您一次可以拥有多个活动服务器。在这种情况下,也许复选框列表会更好?