我遇到了在页面上显示按钮的问题。有两个按钮叫做“上传”和“保存”。开始时“上传”按钮是可见的,而保存按钮具有.setVisible(false)。Wicket:在Ajax响应中显示按钮
…
<tr>
<td width="35%" align="right">
<input type="submit" wicket:id="createUploadButton" value="Upload" class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all"/>
</td>
<td width="30%" align="right">
</td>
<td width="35%" align="left">
<input type="submit" wicket:id="createCancelButton" value="Cancel" class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all"/>
</td>
</tr>
在上传AjaxRequest按钮期间,需要显示“保存”按钮并隐藏上传按钮,但出现错误。代码片段如下所示:
AjaxButton createSaveButton=new IndicatingAjaxButton("createSaveButton"){
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
// TODO Auto-generated method stub
}
};
createSaveButton.setVisible(uploaded);
createSaveButton.setOutputMarkupId(true);
form.add(createSaveButton);
AjaxButton createUploadButton=new IndicatingAjaxButton("createUploadButton"){
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
…
createUploadButton.setVisible(false);
createSaveButton.setVisible(true);
target.addComponent(createUploadButton);
target.addComponent(createSaveButton);
}
createUploadButton.setOutputMarkupId(true);
form.add(createUploadButton);
有人知道问题在哪里吗?
谢谢! Sonja
你能正确格式化你的代码吗? – ireddick 2010-08-05 12:57:09