在wicket 8.x版本中,指示按钮单击时出现以下错误。
错误|发生异常:java.lang.illegalstateexception:尝试在没有模型的组件上设置模型对象!将imodel传递给构造函数或使用#setdefaultmodel(newsomemodel(object))。组成部分:form:savedquery at org.apache.wicket.component.setdefaultmodelobject(组件。java:2999)位于org.apache.wicket.igenericcomponent.setmodelobject(igenericcomponent。java:81)在org.apache.wicket.markup.html.form.formcomponent.updatemodel(formcomponent。java:1100)在org.apache.wicket.markup.html.form.form$formmodelupdatevisitor.component(表单。java:223)在org.apache.wicket.markup.html.form.form$formmodelupdatevisitor.component(form。java:193)访问org.apache.wicket.util.visit.visits.visitpostorderhelper(visits。java:274)访问org.apache.wicket.util.visit.visits.visitpostorderhelper(visits。java:262)在org.apache.wicket.util.visit.visits.visitpostorder(访问。java:245)在org.apache.wicket.markup.html.form.formcomponent.visitComponentsStorder(formcomponent。java:426)位于org.apache.wicket.markup.html.form.form.internalupdateformcomponentmodels(表单。java:1873)在org.apache.wicket.markup.html.form.form.updateformcomponentmodels(表单。java:1838)在org.apache.wicket.markup.html.form.form.process(表单。java:990)在org.apache.wicket.markup.html.form.form.onformsubmitted(form。java:825)在org.apache.wicket.ajax.form.ajaxformsubmitbehavior.onevent(ajaxformsubmitbehavior。java:176)在org.apache.wicket.ajax.ajaxeventbehavior.respond(ajaxeventbehavior。java:127)在org.apache.wicket.ajax.abstractdefaultajaxbehavior.onrequest(abstractdefaultajaxbehavior)。java:598)在org.apache.wicket.core.request.handler.listenerrequesthandler.internalinvoke(listenerrequesthandler。java:306)在org.apache.wicket.core.request.handler.listenerrequesthandler.invoke(listenerrequesthandler。java:280)在org.apache.wicket.core.request.handler.listenerrequesthandler.invokelistener(listenerrequesthandler。java:222)在org.apache.wicket.core.request.handler.listenerrequesthandler.respond(listenerrequesthandler。java:208)在org.apache.wicket.request.cycle.requestcycle$handlerexecutor.respond(requestcycle。java:914)在org.apache.wicket.request.requesthandlerexecutor.execute(requesthandlerexecutor。java:65)在org.apache.wicket.request.cycle.requestcycle.execute(requestcycle。java:282)在org.apache.wicket.request.cycle.requestcycle.processrequest(requestcycle。java:253)在org.apache.wicket.request.cycle.requestcycle.processrequestanddetach(requestcycle。java:221) 在org.apache.wicket.protocol.http.wicketfilter.processrequestcycle(wicketfilter。java:275)在org.apache.wicket.protocol.http.wicketfilter.processrequest(wicketfilter。java:206)在org.apache.wicket.protocol.http.wicketfilter.dofilter(wicketfilter。java:299)在org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain)。java:193)在org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain。java:166)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:320)在org.springframework.security.web.access.intercept.filtersecurityinterceptor.invoke(filtersecurityinterceptor。java:126)在org.springframework.security.web.access.intercept.filtersecurityinterceptor.dofilter(filtersecurityinterceptor。java:90)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334) 在org.springframework.security.web.access.exceptiontranslationfilter.dofilter(exceptiontranslationfilter。java:118)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.session.sessionmanagementfilter.dofilter(sessionmanagementfilter。java:137)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.authentication.anonymousauthenticationfilter.dofilter(anonymousauthenticationfilter。java:111)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.authentication.rememberme.rememberAuthenticationFilter.dofilter(rememberAuthenticationFilter)。java:158)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.servletapi.securitycontextholderawarerequestfilter.dofilter(securitycontextholderawarerequestfilter)。java:158)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.savedrequest.requestcacheawarefilter.dofilter(requestcacheawarefilter。java:63)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.authentication.验证。www.basicauthenticationfilter.dofilterinternal(基本身份验证筛选器。java:204)在org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter。java:119)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.header.headerwriterfilter.doheadersafter(headerwriterfilter。java:92)在org.springframework.security.web.header.headerwriterfilter.dofilterinternal(headerwriterfilter。java:77)在org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter。java:119)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)位于org.springframework.security.web.context.request.async.webasyncmanagerintegrationfilter.dofilterinternal(webasyncmanagerintegrationfilter)。java:56)在org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter。java:119) 在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)位于org.springframework.security.web.context.securitycontextpersistencefilter.dofilter(securitycontextpersistencefilter)。java:105)在org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy。java:334)在org.springframework.security.web.filterchainproxy.dofilternternal(filterchainproxy。java:215)在org.springframework.security.web.filterchainproxy.dofilter(filterchainproxy。java:178)在org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy。java:358)在org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy。java:271)位于org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain)。java:193)在org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain。java:166)在org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve。java:199)在org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve。java:96)在org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase。java:543)在org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve。java:139)在org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve。java:81)在org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve。java:688)在org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve。java:87)在org.apache.catalina.connector.coyoteadapter.service(coyoteadapter。java:343)在org.apache.coyote.http11.http11processor.service(http11processor。java:615)在org.apache.coyote.abstractprocessorlight.process(abstractprocessorlight。java:65)在org.apache.coyote.abstractprotocol$connectionhandler.process(abstractprotocol。java:818)位于org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint)。java:1623)在org.apache.tomcat.util.net.socketprocessorbase.run(socketprocessorbase。java:49)位于java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor。java:1149)在java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor。java:624)在org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread。java:61)在java.lang.thread.run(线程。java:748)
final DropDownChoice<String> listSites = (DropDownChoice<String>) new DropDownChoice<String>("savedQueries", new PropertyModel<String>(TestPage.this.getModel(), "selectedValue"), savedQueries).add(new FormComponentUpdatingBehavior() {
private static final long serialVersionUID = 1L;
protected void onUpdate() {
// Update logic
}
protected void onError(RuntimeException ex) {
super.onError(ex);
}
});
listSites.setOutputMarkupId(true);
add(listSites);
TextField savedQuery = new TextField<>("savedQuery"); // CHECK LATER
savedQuery.setOutputMarkupId(true);
add(savedQuery);
final IndicatingAjaxButton deleteMcb = new IndicatingAjaxButton("delete") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
String message=null;
List<String> savedQueries = null;
try{
//on submit process logic
}catch(Exception e){
e.printStackTrace();
}
listSites.setChoices(savedQueries);
listSites.setModelObject(null);
target.add(listSites);
savedQuery.setModelObject(null);
target.add(savedQuery);
target.add(feedback);
error(message);
}
};
1条答案
按热度按时间3hvapo4f1#
在为textfield对象添加下面这行代码之后,我已经解决了这个异常。
queryname在这里是一个字符串值参数。