我有一个这样的检票口页面:
public final class Services extends WebPage {
public Services() {
super();
}
public Services(PageParameters params) {
StringValue serviceType = params.get("name");
if("report".equals(serviceType.toString())) {
this.getResponse().write("HelloWorld");
}
}
}
它的HTML是空的。 当我调用此页面的URL时,我看到此错误
Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at java.util.Collections$UnmodifiableList.get(Collections.java:1211)
at org.apache.wicket.markup.Markup.get(Markup.java:130)
at org.apache.wicket.Component.internalRender(Component.java:2356)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.Page.renderPage(Page.java:1010)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:271)
at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
...
我不知道我的简单检票页真的出了什么问题。
答案 0 :(得分:3)
Wicket曾希望相关HTML模板中的某些标记符合代码。作为您的例外的发起人的行在 Component.class 中参见
private final void internalRender()
{
...
MarkupElement elem = markup.get(0);
...
}
该代码获取相关标记的“根”元素。没有任何标记的代码在Wicket中是非常的。
提示:如果您只想处理请求,请安装可共享资源或除页面之外的其他一些资源。