检票口 ModalWindow 错误
我是 wicket 新手,当我尝试运行我的应用程序时,我收到以下错误:
WicketMessage:模态窗口内容 id 错误。组件ID:myPanel;内容 ID:内容:
在我的 AddStudent html 中:
<span wicket:id="InformationDialog"/>
<span wicket:id="myPanel"/>
这些是在 AddStudent.java 中的开始标记之后的第一件事
(在构造函数中):
panel=new InformationPanel("myPanel");
message=new ModalWindow("InformationDialog");
message.setContent(panel);
message.setCssClassName(ModalWindow.CSS_CLASS_BLUE);
message.setTitle("Important Information");
其中 InformationPanel 扩展了 Panel:
<html>
<wicket:panel>
<table>
<tr>
<td><span wicket:id="message"/></td>
</tr>
<tr>
<td><input type ="button" value ="OK" wicket:id="ok"/></td>
</tr>
</table>
</wicket:panel>
<html>
显然,我有一个相应的 java 类 - 它可能不相关,但在这里它是:
package myapp.project;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.panel.Panel;
public class InformationPanel extends Panel {
private Button ok;
private Label messageLabel;
public InformationPanel(String id){
super(id);
messageLabel=new Label("message","");
ok=new Button("ok"){
public void onSubmit(){
AddStudent student = new AddStudent();
setResponsePage(student);
}
};
add(ok);
add(messageLabel);
}
public void setSuccessful(){
messageLabel.setDefaultModelObject("You have successfully added the student");
}
public void setUnSuccessful(){
messageLabel.setDefaultModelObject("A student with that username already exists!");
}
}
不知道问题所在。提前致谢
I'm new to wicket, and I get he following error when I try to run my application:
WicketMessage: Modal window content id is wrong. Component ID:myPanel; content ID: content:
in my AddStudent html:
<span wicket:id="InformationDialog"/>
<span wicket:id="myPanel"/>
These are the first things after my opening tag
in AddStudent.java(in the constructor):
panel=new InformationPanel("myPanel");
message=new ModalWindow("InformationDialog");
message.setContent(panel);
message.setCssClassName(ModalWindow.CSS_CLASS_BLUE);
message.setTitle("Important Information");
where InformationPanel extends Panel:
<html>
<wicket:panel>
<table>
<tr>
<td><span wicket:id="message"/></td>
</tr>
<tr>
<td><input type ="button" value ="OK" wicket:id="ok"/></td>
</tr>
</table>
</wicket:panel>
<html>
Obviously, I have a corresponding java class-it might not be relevant but here it is:
package myapp.project;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.panel.Panel;
public class InformationPanel extends Panel {
private Button ok;
private Label messageLabel;
public InformationPanel(String id){
super(id);
messageLabel=new Label("message","");
ok=new Button("ok"){
public void onSubmit(){
AddStudent student = new AddStudent();
setResponsePage(student);
}
};
add(ok);
add(messageLabel);
}
public void setSuccessful(){
messageLabel.setDefaultModelObject("You have successfully added the student");
}
public void setUnSuccessful(){
messageLabel.setDefaultModelObject("A student with that username already exists!");
}
}
No idea of the problem. Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 AddStudent.java 构造函数中,您的
Wicket
ModalWindow
需要其内容具有特定的 id,但您不匹配该 id。尝试将其更改为
message.getContentId()
应该使 id 对齐。In your AddStudent.java constructor , you have
Wicket
ModalWindow
needs its content to have a specific id, which you're not matching.Try changing this to
The
message.getContentId()
should make the ids align.