import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.Model;
import java.io.Serializable;
import java.util.ArrayList;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import com.ui.*;
public class WelcomePage extends WebPage{
private static final long serialVersionUID = 1L;
public WelcomePage(){
Contact contact = null;
final List<Contact> list = new ArrayList<Contact>();
char character;
// a - z
for(int i = 97; i < 123; i++){
character = (char) i;
contact = new Contact(String.valueOf(character));
list.add(contact);
}
final DataView<Contact> dataView =
new DataView<Contact>("simple", new ListDataProvider<Contact>(list)){
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<Contact> item){
final Contact user = item.getModelObject();
item.add(new Label("id", user.getId()));
}
};
dataView.setItemsPerPage(10);
add(dataView);
add(new PagingNavigator("navigator", dataView));
}
}
WelcomePage.html
<!DOCTYPE html>
<html>
<body>
<span wicket:id="lbl"> </span>
<wicket:extend>
<table cellspacing="0" class="dataview">
<tbody>
<tr wicket:id="simple">
<td><span wicket:id="id">Test ID</span></td>
</tr>
</tbody>
</table>
<div wicket:id="navigator"></div>
</wicket:extend>
</body>
</html>
위의 코드는 표시 DataView를위한 위의 코드를 실행하면 다음 오류가 발생합니다.
Last cause: Can not determine Markup. Component is not yet connected to a parent. [Page class = com.kaiinos.kriti.ui.WelcomePage, id = 12, render count = 1]
,451,515,
스택 트레이스 - 근본 원인 :
org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup. Component is not yet connected to a parent. [Page class = com.kaiinos.kriti.ui.WelcomePage, id = 12, render count = 1]
at org.apache.wicket.Component.getMarkup(Component.java:751)
at org.apache.wicket.Component.internalRender(Component.java:2378)
at org.apache.wicket.Component.render(Component.java:2341)
at org.apache.wicket.Page.renderPage(Page.java:1018)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236)
at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
편집 - 자바 코드와 HTML하지만 같은 error.I을 얻는 수정은 초보자입니다. 도움을 주시면 감사하겠습니다. 미리 감사드립니다.
, 그것은 잘못이다 : XML 선언이 먼저 와야한다. – svenmeier
...을 사용하고 있는데, BasePage에 마크 업이 있습니까? –
svenmeier
예외는 "WelcomePage"라고하지만 Java 코드는 Sub1Page에 관한 것입니다. 또한 HTML이 불완전합니다.