我有两个单选按钮(值A或B)和下面的调色板区域。我想在选择值A时显示调色板,并在选择B时隐藏它,因此ajax更新。 怎么做? 我正在使用旧的Tapestry 4.0.2进行现有项目,所以我无法升级。
到目前为止,这是我的代码
标记:
<span jwcid="models@RadioGroup" selected="ognl:modelOption">
<tr>
<td class="dataLabel" width="15%">
</td>
<td>
<input type="radio" jwcid="@Radio" value="ognl:@com.example.MyPage@ALL"/> All models (Default)
</td>
</tr>
<tr>
<td class="dataLabel" width="15%">
</td>
<td>
<input type="radio" jwcid="@Radio" value="ognl:@com.example.MyPage@SPECIFIC"/> Specific models
</td>
</tr>
</span>
<span jwcid="@If" condition="ognl:specificDeviceModels">
<tr>
<td class="dataLabel" width="15%">
<span key="supportedDeviceModelsLabel">Supported device models:</span>:
</td>
<td>
<div class="bundle_palette">
<span jwcid="palette"/>
</div>
</td>
</tr>
</span>
爪哇:
public static final Integer ALL = new Integer(1);
public static final Integer SPECIFIC = new Integer(2);
public abstract Integer getModelOption();
public abstract List<DeviceModel> getSelectedDeviceModels();
public abstract void setSelectedDeviceModels(List<DeviceModel> deviceModels);
public abstract void setDeviceModels(List<DeviceModel> deviceModels);
public abstract List<DeviceModel> getDeviceModels();
@Component(type = "contrib:Palette", bindings = {"selected=selectedDeviceModels", "model=deviceModel"})
public abstract Palette getPalette();
public IPropertySelectionModel getDeviceModel() {
return new OptionValueSelectionModel(getDeviceModels()).sorted();
}
public void pageBeginRender(PageEvent event) {
setDeviceModels(getDeviceService().findDeviceModels(null));
}
public boolean getSpecificDeviceModels() {
//here I need to set boolean value and return it
return true/false;
}
答案 0 :(得分:0)
作为这个旧版Tapestry的解决方案,我不得不使用tacos库:
http://tacos.sourceforge.net/components/tapestry/RadioGroup.html