SEVERE:servlet [jsp]的Servlet.service()引发了异常 java.lang.IllegalStateException:既不是BindingResult也不是普通的 bean名称的目标对象'更新'可用作请求属性 在 org.springframework.web.servlet.support.BindStatus。(BindStatus.java:144) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:116) 在 org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422) 在 org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) 在 org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84) 在 org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80) 在 org.apache.jsp.WEB_002dINF.views.Manage_005fTemplate_jsp._jspx_meth_form_005finput_005f0(Manage_005fTemplate_jsp.java:990)at at org.apache.jsp.WEB_002dINF.views.Manage_005fTemplate_jsp._jspx_meth_form_005fform_005f0(Manage_005fTemplate_jsp.java:924) 在 org.apache.jsp.WEB_002dINF.views.Manage_005fTemplate_jsp._jspService(Manage_005fTemplate_jsp.java:714) 在org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443) 在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) 在org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) 在 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470) 在 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395) 在 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) 在 org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168) 在 org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) 在 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1271) 在 org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) 在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) 在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) 在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 在 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:635)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在 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:198) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) 在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) 在 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) 在 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) 在 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) 在 org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:790) 在 org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1468) 在 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(Thread.java:748)
2018年6月10日下午1:46:55 org.apache.catalina.core.StandardWrapperValve 在上下文中为servlet [dispatcher]调用SEVERE:Servlet.service() 与路径[/ eposh]抛出异常[java.lang.IllegalStateException: BindingResult既不是bean名称的明确目标对象,也不是更新' 根据原因提供请求属性] java.lang.IllegalStateException:既不是BindingResult也不是普通的 bean名称的目标对象'更新'可用作请求属性 在 org.springframework.web.servlet.support.BindStatus。(BindStatus.java:144) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132) 在 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:116) 在 org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422) 在 org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) 在 org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84) 在 org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80) 在 org.apache.jsp.WEB_002dINF.views.Manage_005fTemplate_jsp._jspx_meth_form_005finput_005f0(Manage_005fTemplate_jsp.java:990)at at org.apache.jsp.WEB_002dINF.views.Manage_005fTemplate_jsp._jspx_meth_form_005fform_005f0(Manage_005fTemplate_jsp.java:924) 在 org.apache.jsp.WEB_002dINF.views.Manage_005fTemplate_jsp._jspService(Manage_005fTemplate_jsp.java:714) 在org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443) 在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) 在org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) 在 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470) 在 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395) 在 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) 在 org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168) 在 org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) 在 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1271) 在 org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) 在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) 在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) 在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 在 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:635)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在 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:198) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) 在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) 在 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) 在 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) 在 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) 在 org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:790) 在 org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1468) 在 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(Thread.java:748)
我的Controller.java
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
public String editTemplate(@PathVariable int id, HttpServletRequest request, HttpServletResponse reponse) {
System.out.println("get by id" + id);
ModelAndView model = new ModelAndView("Manage_Template");
model.addObject("update", ts.getTemplateById(id));
/*model.addAttribute("update", ts.getTemplateById(id));*/
return "Manage_Template";
}
我的JSP:
<div class="modal fade" id="myModal1" role="dialog">
<div class="modal-dialog" style="width:80%;">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Update Template</h4>
</div>
<div class="modal-body">
<div class="box box-warning">
<div class="box-header">
</div>
<div class="box-body">
<form:form role="form" action="" method="post" id="update_form" commandName="update" modelAttribute="update">
<section class="col-lg-12">
<div class="form-group">
<form:input path="template_name" class="form-control" placeholder="Name Of Template" name="template_name" />
</div>
</section>
<section class="col-lg-12">
<form:textarea id="editor1" rows="10" cols="80" path="summary" placeholder="Place some text here" name="summary" />
<!-- </textarea> -->
</section><br>
<div class="form-group">
<input type="submit" class="form-control btn btn-primary" value="Update Template" id="update_template_id">
</div>
</form:form>
</div>
</div>
</div>
</div>
</div>
<!---- in this JSP I am getting error -->
<td><button onclick="editTemplate(<%=rs.getString(1)%>)" data-target="#myModal1" data-toggle="modal" title="Edit" class="btn btn-success btn-sm"><i class="fa fa-edit"></i>Edit</button></td>
<script>
function editTemplate(id) {
$.get("update/" + id, function(result) {
/* $("#myModal1").modal('show') */
});
}
</script>
</div>
答案 0 :(得分:0)
因为JSP视图中缺少属性(update
属性)
同样在你的控制器中你返回一个Sting而不是一个模式视图,所以使用Model作为方法参数(而不是实例化模型和视图)并在其中附加你的模型属性,你的控制器应该如下所示: / p>
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
public String editTemplate(@PathVariable int id,
Model model,
HttpServletRequest request,
HttpServletResponse reponse) {
System.out.println("get by id"+id);
model.addAttribute("update",ts.getTemplateById(id));
return "Manage_Template";
}
注意: ts.getTemplateById(id)是什么?确切地说(服务,组件?)?