2
我新的檢票口,我得到他下面的錯誤,當我嘗試運行我的應用程序:檢票ModalWindow錯誤
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擴展面板:
<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!");
}
}
問題的不知道。提前
謝謝,但現在它說:WicketMessage:無法在[MarkupContainer [Component id = _extend8]]中找到id爲'InformationDialog'的組件。這意味着您在標記中聲明瞭wicket:id = InformationDialog,但是您根本沒有將該組件添加到您的頁面,或者層次結構不匹配。 [markup = file:/ C:/workspace/MyApp/context/WEB-INF/classes/myapp/project/AddStudent.html – 2010-12-15 23:14:45
這是您的html標記和您的java之間的不匹配。你的AddStudent類是否缺少'add(message)'? – 2010-12-15 23:50:51
多數民衆贊成在我發佈後很快就實現了 - 以爲我發佈了我已經排序它,但顯然不是。非常感謝! – 2010-12-16 10:00:25