无法从WicketStuff中找到资源org.apache.wicket.mfu.delete:MultiFileUploadField.java

时间:2011-02-15 17:49:38

标签: java packages wicket

我一直在尝试合并来自wicketstuff.org的MultiFileUpload示例,但无法找到org.apache.wicket.mfu.delete的资源。原始代码可以在上面的链接中找到,我现在已经省略了我的代码,但如果有帮助可以包含它。对缺少的包的调用发生在org.apache.wicket.markup.html.form.upload.MultiFileUploadField.java的renderHead()方法中,该方法是只读的。我正在使用wicket-1.3.1.jar。我在下面的代码中从org.apache.wicket.markup.html.IHeaderContributor调用renderHead()方法。

非常感谢任何帮助。

    add(new HeaderContributor(new IHeaderContributor() {
        @Override
        public void renderHead(IHeaderResponse response) {
            response.renderOnLoadJavascript("document.getElementById('" + summaryField.getMarkupId() + "').focus()");
        }
    }));

接下来是我对MultiFileUploadField()的调用,其中出现导致问题的renderHead()方法驻留。

    add(new MultiFileUploadField("fileInput", new PropertyModel(this, "uploads"), 5));

最后这是堆栈跟踪:

2011-02-15 10:46:25,233 [http-8080-2] DEBUG [info.jtrac.wicket.JtracApplication] - i18n failed for key: 'org.apache.wicket.mfu.delete', Class: class org.apache.wicket.markup.html.form.upload.MultiFileUploadField, Style: null, Exception: org.springframework.context.NoSuchMessageException: No message found under code 'org.apache.wicket.mfu.delete' for locale 'en'.
2011-02-15 10:46:25,233 [http-8080-2] ERROR [org.apache.wicket.RequestCycle] - Exception in rendering component: [MarkupContainer [Component id = _header_0, page = info.jtrac.wicket.ItemFormPage, path = 4:_header_0.HtmlHeaderContainer, isVisible = true, isVersioned = true]]
org.apache.wicket.WicketRuntimeException: Exception in rendering component: [MarkupContainer [Component id = _header_0, page = info.jtrac.wicket.ItemFormPage, path = 4:_header_0.HtmlHeaderContainer, isVisible = true, isVersioned = true]]
        at org.apache.wicket.Component.renderComponent(Component.java:2497)
        at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)
        at org.apache.wicket.Component.render(Component.java:2296)
        at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:222)
        at org.apache.wicket.markup.resolver.HtmlHeaderResolver.resolve(HtmlHeaderResolver.java:78)
        at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1267)
        at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1370)
        at org.apache.wicket.Page.onRender(Page.java:1446)
        at org.apache.wicket.Component.render(Component.java:2296)
        at org.apache.wicket.Page.renderPage(Page.java:891)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.MissingResourceException: Unable to find resource: org.apache.wicket.mfu.delete for component: form:fileInput [class=org.apache.wicket.markup.html.form.upload.MultiFileUploadField]
        at org.apache.wicket.Localizer.getString(Localizer.java:262)
        at org.apache.wicket.Localizer.getString(Localizer.java:112)
        at org.apache.wicket.Component.getString(Component.java:1787)
        at org.apache.wicket.Component.getString(Component.java:1774)
        at org.apache.wicket.markup.html.form.upload.MultiFileUploadField.renderHead(MultiFileUploadField.java:202)
        at org.apache.wicket.Component.renderHead(Component.java:2532)
        at org.apache.wicket.markup.html.form.FormComponentPanel.renderHead(FormComponentPanel.java:183)
        at org.apache.wicket.markup.html.internal.HtmlHeaderContainer$1.component(HtmlHeaderContainer.java:212)
        at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:821)
        at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:836)
        at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:861)
        at org.apache.wicket.markup.html.internal.HtmlHeaderContainer.renderHeaderSections(HtmlHeaderContainer.java:203)
        at org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:136)
        at org.apache.wicket.Component.renderComponent(Component.java:2459)
        ... 36 more

1 个答案:

答案 0 :(得分:1)

根据错误消息,在.properties文件中没有为multifileupload字段的delete字符串定义字符串。

我想你需要在你的Application.properties(一个与你的Application类同名的属性文件,但扩展名为.properties)中定义这个,使用以下语法:

org.apache.wicket.mfu.delete=remove