我將應用程序從較舊版本的wicket遷移到wicket 8.某些頁面正常工作(簡單頁面如登錄)。這些頁面不使用擴展機制。 當我訪問具有該機制的頁面時,它不起作用。我不知道這是否是一個錯誤,但我嘗試了一切,找不到解決方案。 我正在使用檢票8.0.0-M5(我知道這不是一個穩定版本)。任何人都有同樣的問題? 這裏是我的代碼:Wicket 8 - 擴展機制不起作用
WerklijstPageXXX.html
<html xmlns:wicket>
<body>
<wicket:extend>
<div wicket:id="panelXXX"></div>
</wicket:extend>
</body>
WerklijstPanelXXX.html
<wicket:head xmlns:wicket>
</wicket:head>
<wicket:panel xmlns:wicket>
<div wicket:id="filter">
<div wicket:id="label"></div>
</div>
</wicket:panel>
WerklijstPageXXX.java
public class WerklijstPageXXX extends BasePage {
private WerklijstPanelXXX werklijstPanel;
public WerklijstPageXXX() {
werklijstPanel = new WerklijstPanelXXX("panelXXX"){};
add(werklijstPanel);
}
@Override
public Panel getContextPanel(String id)
{
return werklijstPanel.getWerklijstFilterPanel();
}
WerklijstPanelXXX.java
public abstract class WerklijstPanelXXX extends Panel {
private static final Logger LOG = LoggerFactory
.getLogger(WerklijstPanelXXX.class);
private Panel filterPanel;
public WerklijstPanelXXX(String id) {
super(id);
WebMarkupContainer upperPanel = new WebMarkupContainer("filter");
filterPanel = new Panel("filterPanel") {
};
add(upperPanel);
upperPanel.add(new Label("label"));
}
public Panel getWerklijstFilterPanel() {
return filterPanel;
}
編輯: BasePage.html(它的一部分)
<div id="body" class="body">
<div id="aside" class="aside">
<div wicket:id="contextPanel"></div>
</div>
<div id="content" class="content">
<div class="padding">
<wicket:child></wicket:child>
</div>
</div>
</div>
BasePage.java
@Override
protected void onInitialize() {
super.onInitialize();
add(getContextPanel("contextPanel"));
addTabMenu();
addMenu();
addPatientBar();
}
錯誤:
根源:
org.apache.wicket.WicketRuntimeException:下面的組件無法呈現。可能的原因可能是這樣的: 1)你已經在代碼中添加了一個組件,但忘記在標記中引用它(因此組件將不會被渲染), 2)如果你的組件被添加到父容器中,子容器的標記包含它們。
- [WerklijstPanelXXX [組件ID = panelXXX,頁= nl.philips.raris.web.werklijst.WerklijstPageXXX,路徑= panelXXX,類型= nl.philips.raris.web.werklijst.WerklijstPanelXXX,ISVISIBLE =真, [WebMarkupContainer [Component ID = filter]]]
- [WebMarkupContainer [Component id = filter,page = nl.philips.raris.web.werklijst.WerklijstPageXXX,path = panelXXX:filter,type = org.apache.wicket.markup.html.WebMarkupContainer,isVisible = true,isVersioned = true],children = [Component id = label]]
- [Component id = label,page = nl.philips.raris.web.werklijst .WerklijstPageXXX,path = panelXXX:filter:label,type = org.a pache.wicket.markup.html.basic.Label,isVisible = true,isVersioned = true]
[Panel [Component id = filterPanel,page = nl.philips.raris.web.werklijst.WerklijstPageXXX,path = filterPanel,鍵入= org.apache.wicket.markup.html.panel.Panel,ISVISIBLE =真,isVersioned = TRUE]]
在org.apache.wicket.Page.checkRendering(Page.java:662) 在有機apache.wicket.Page.onAfterRender(Page.java:805) at org.apache.wicket.markup.html.WebPage.onAfterRender(WebPage.java:209) at org.apache.wicket.Component.afterRender(Component。 java:919) at org。apache.wicket.Component.render(Component.java:2335) at org.apache.wicket.Page.renderPage(Page.java:987) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage( (WebPageRenderer.java:124) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler。org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236) 。 Java的:175) 在org.apache.wicket.request.cycle.RequestCycle $ HandlerExecutor.respond(RequestCycle.java:912) 在org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65) 在org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:283) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCyc le.java:253) 在org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:221) 在org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:262) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:204) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137) at javax.servlet。 httphttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) at org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1669) at org.apache.shiro.web.servlet.AbstractShiroFilter.exe cuteChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter $ 1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java :90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) at org .apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.springframework.web.filter org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) .DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:262) at org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151 ) 在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)
你是什麼意思的「不行」?它只是顯示基本頁面還是會出現異常?如果你分享了BasePage的代碼+ html,它可能會很好。如果BasePage中沒有正確的標記,標記將不起作用。 –
對不起。我忘了添加錯誤和BasePage的東西。 – fselvatici