Jun 12, 2019 5:13:04 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [spring] in context with path [/quaris] threw exception [An exception occurred processing [/WEB-INF/jsp/studentEdit.jsp] at line [11]
8: <table >
9: <tr>
10: <td></td>
11: <td><form:hidden path="id" /></td>
12: </tr>
13: <tr>
14: <td>userName : </td>
Stacktrace:] with root cause
org.springframework.beans.NotReadablePropertyException: Invalid property 'id' of bean class [java.util.ArrayList]: Bean property 'id' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:622)
at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:612)
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:158)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:177)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:163)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:148)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:138)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:121)
at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:459)
at org.springframework.web.servlet.tags.form.HiddenInputTag.writeTagContent(HiddenInputTag.java:112)
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:86)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:83)
at org.apache.jsp.WEB_002dINF.jsp.studentEdit_jsp._jspx_meth_form_005fhidden_005f0(studentEdit_jsp.java:247)
at org.apache.jsp.WEB_002dINF.jsp.studentEdit_jsp._jspx_meth_form_005fform_005f0(studentEdit_jsp.java:186)
at org.apache.jsp.WEB_002dINF.jsp.studentEdit_jsp._jspService(studentEdit_jsp.java:140)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:170)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1370)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1116)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1839)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
package com.sample.Entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="Student")
public class Student {
@Id
@GenericGenerator(name="inc",strategy="increment")
@GeneratedValue(generator="inc")
@Column(name="id")
private int id;
@Column(name="username")
private String username;
@Column(name="password")
private int password;
public Student() {
// TODO Auto-generated constructor stub
}
public Student(int id, String username) {
super();
this.id = id;
this.username = username;
}
public Student(int id, String username, int password) {
super();
this.id = id;
this.username = username;
this.password = password;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getPassword() {
return password;
}
public void setPassword(int password) {
this.password = password;
}
}
这是控制器:
@RequestMapping(value="/editstd/{id}")
public String edit(@PathVariable int id, Model m){
List<Student> std= studentService.editStudent(id);
m.addAttribute("command",std);
return "studentEdit";
}
@RequestMapping(value="/editsave",method = RequestMethod.POST)
public String editsave(@ModelAttribute("student") Student student){
studentService.updateStudent(student);
return "redirect:/userDetails";
}
这是要编辑的jsp页面:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<h1>Edit Student</h1>
<form:form method="POST" action="/quaris/editsave">
<table >
<tr>
<td></td>
<td><form:hidden path="id" /></td>
</tr>
<tr>
<td>userName : </td>
<td><form:input path="username" /></td>
</tr>
<tr>
<td>Password :</td>
<td><form:input path="password" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Edit Save" /></td>
</tr>
</table>
</form:form>
我试图编辑一个jsp页面,但我无法编辑。它显示了getters和setters方法的错误。欢迎提出任何建议。提前感谢!KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
问题来自id
字段。您在代码中做出了矛盾的选择。在你的实体上,你有以下内容:
@Id
@GenericGenerator(name="inc",strategy="increment")
@GeneratedValue(generator="inc")
@Column(name="id")
private int id;
这意味着您将id
属性的增量委托给生成器。那么为什么你有:
<td><form:hidden path="id" /></td>
以你的形式?永远不要手动设置ID
(测试除外)。
Invalid property 'id' of bean class [java.util.ArrayList]
我试图使用Spring MVC将验证添加到表单中,但我总是得到一个Http Status500错误,我很难找到根本原因。每次我为了修复它而做一个小的更改时,我都会得到一个不同的错误,但它们最终都是500个,而且似乎都指向jsp文件(在这一点上,我认为这不是问题的原因,但这就是我得到的错误)。如果从表单和输入中删除标记,错误就会消失,但验证表单的能力也会消失。 以下是(据我所知)来自我的pom.xm
我试图从一个表单执行一个简单的提交操作。我的项目使用带有百里香叶模板的Spring引导框架。使用的语言是eclipse IDE中的java。 我要做的就是从表单中获取empname和empid(参考员工类)并将其存储在java对象中。 当我运行应用程序时,应用程序打开,当我导航到edit.html时,我在浏览器中收到这条错误消息- Whitelabel错误页此应用程序没有/Error的显式映射,因
现在在用spring框架spring boot version = ' 1 . 5 . 9 . release '做java。但是每次我运行我的网络应用程序时 org.springframework.beans.NotReadable属性异常: bean类的无效属性'id'[java.util.ArrayList]: Bean属性'id'不可读或具有无效的getter方法:getter的返回类型是
问题内容: 我正在开发示例。我开发了XML文件并能够成功编译代码,但是在运行mu示例代码时出现以下错误。不知道出了什么问题? jdbc-composite-item-reader-job.xml Employee.java 客户.java CompositeMain.java 我的数据库详细信息: 我看到问题已经存在:http : //forum.spring.io/forum/spring- p
我是Spring的新手,我有个例外。 我有一个jsp,有很多选择。它们都工作正常,但有一个显示了这个例外: 我正在以与其他工作正常的人相同的方式实施selct。下面是jsp代码: 这里是控制器: 这里,实体Expediente: 最后是TipoExpedinte实体 我认为这可能发生,因为PharmantePadre属性是同一实体Pharmante的外键,但我不知道如何解决它。。。 要帮忙吗?谢谢