Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
org.springframework.beans.NotReadablePropertyException:bean类bean属性的无效属性不可读或具有无效的getter方法_Spring_Jsp_Spring Mvc - Fatal编程技术网

org.springframework.beans.NotReadablePropertyException:bean类bean属性的无效属性不可读或具有无效的getter方法

org.springframework.beans.NotReadablePropertyException:bean类bean属性的无效属性不可读或具有无效的getter方法,spring,jsp,spring-mvc,Spring,Jsp,Spring Mvc,SpringMVC对我来说是新事物。我想有一些关于SpringMVC的综合文献和示例(即使是官方文档也不容易理解) 所以我面临的问题是: Jun 15, 2013 2:42:36 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [appServlet] in context with path [/controller] threw exception [A

SpringMVC对我来说是新事物。我想有一些关于SpringMVC的综合文献和示例(即使是官方文档也不容易理解)

所以我面临的问题是:

Jun 15, 2013 2:42:36 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/controller] threw exception [An exception occurred processing JSP page /WEB-INF/views/index.jsp at line 27

24: 
25: <form:form  commandName="creationDate" method="GET" action="add">
26: 
27: <form:label path="creationDate.ParticularDate">Particular Date</form:label>
28: <form:input path="creationDate.ParticularDate" />
29: 
30: <form:label path="creationDate.childGoSchoolDate">Child go to School</form:label>


Stacktrace:] with root cause
org.springframework.beans.NotReadablePropertyException: Invalid property 'creationDate' of bean class [edu.demidov.dom.CreationDate]: Bean property 'creationDate' 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.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:707)
    at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:554)
    at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:531)
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:697)
    at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:99)
    at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:218)
    at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)
    at org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:130)
    at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:120)
    at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:90)
    at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:103)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
    at org.apache.jsp.WEB_002dINF.views.index_jsp._jspx_meth_form_005flabel_005f0(index_jsp.java:184)
    at org.apache.jsp.WEB_002dINF.views.index_jsp._jspx_meth_form_005fform_005f0(index_jsp.java:128)
    at org.apache.jsp.WEB_002dINF.views.index_jsp._jspService(index_jsp.java:88)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
和我的jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>    

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sorting page</title>
</head>

<body>

<h3>Insert data:</h3>

<form:form  commandName="CreationDate" method="GET" action="add">

<form:label path="creationDate.particularDate">Particular Date</form:label>
<form:input path="creationDate.particularDate" />

<form:label path="creationDate.childGoSchoolDate">Child go to School</form:label>
<form:input path="creationDate.childGoSchoolDate"/>


<form:label path="creationDate.childAdmissionDate">Child admission Date</form:label>
<form:input path="creationDate.childAdmissionDate"/>

<input type="submit" value="Save"/>

</form:form>

</body>

</html>

排序页
插入数据:
特定日期
孩子上学
儿童入学日期
是的,我的创作主体:

@Entity
@Table(name="CREATION_DATE")
@NamedQueries ({
@NamedQuery(name="creationDate.findById", query="select distinct c from CreationDate c left join fetch c.institution n " +
                                                  "left join fetch c.scheduleRotationChild s where c.dateId= :i")
})
public class CreationDate implements Serializable {


    private static final long serialVersionUID = 1648102358397071136L;


    private int dateId;

        @Id
        @GeneratedValue(strategy=IDENTITY)
        @Column(name="DATE_ID")
        public int getDateId() {
            return dateId;
        }

        public void setDateId(int dateId) {
            this.dateId = dateId;
        }


    private Date particularDate;

        @Column(name="PARTICULAR_DATE")
        public Date getParticularDate() {
            return particularDate;
        }

        public void setParticularDate(Date particularDate) {
            this.particularDate = particularDate;
        }


    private int version;

        @Version
        @Column(name="VERSION")
        public int getVersion() {
            return version;
        }

        public void setVersion(int version) {
            this.version = version;
        }


    private Date childGoSchoolDate;

        @Temporal(TemporalType.DATE)
        @Column(name="CHILD_GO_SCHOOL_DATE")
        public Date getChildGoSchoolDate() {
            return childGoSchoolDate;
        }

        public void setChildGoSchoolDate(Date childGoSchoolDate) {
            this.childGoSchoolDate = childGoSchoolDate;
        }


    private Date childAdmissionDate;

        @Temporal(TemporalType.DATE)
        @Column(name="CHILD_ADMISSION_DATE")
        public Date getChildAdmissionDate() {
            return childAdmissionDate;
        }

        public void setChildAdmissionDate(Date childAdmissionDate) {
            this.childAdmissionDate = childAdmissionDate;
        }


    private Set<Institution> institution = new HashSet<Institution>();

        @ManyToMany(fetch = FetchType.LAZY)
        @Cascade(org.hibernate.annotations.CascadeType.ALL)
        @JoinTable(name="CREATIONDATE_INSTITUTION", 
                                    joinColumns=@JoinColumn(name="DATE_ID"), 
                                    inverseJoinColumns=@JoinColumn(name="INSTITUTION_ID"))
        public Set<Institution> getInstitution() {
            return institution;
        }

        public void setInstitution(Set<Institution> institutionSet) {
            this.institution = institutionSet;
        }


    private List<ScheduleRotationChild> scheduleRotationChild = new ArrayList<ScheduleRotationChild>();

        @OneToMany(fetch=FetchType.EAGER, orphanRemoval=true)
        @Cascade(org.hibernate.annotations.CascadeType.ALL)
        @JoinTable(name="SRC_DATE", 
                                    joinColumns=@JoinColumn(name="DATE_ID"),
                                    inverseJoinColumns=@JoinColumn(name="SRC_ID"))
        public List<ScheduleRotationChild> getScheduleRotationChild() {
            return scheduleRotationChild;
        }

        public void setScheduleRotationChild(
                List<ScheduleRotationChild> scheduleRotationChild) {
            this.scheduleRotationChild = scheduleRotationChild;
        }





        public void addSetInstitutions(Set<Institution> institution) {

            setInstitution(institution);

        }


        public void addSRC(List<ScheduleRotationChild> srcinstitution) {

        setScheduleRotationChild(srcinstitution);

        }



        public String toString() {

            return "\n" + "ID: " + dateId + " \n " 
            + "Дата: " +particularDate + " \n " 
            + "Дети идут в школу, год: " + childGoSchoolDate + " \n " 
            + "Дата приема детей: " + childAdmissionDate + "  " + scheduleRotationChild + " \n " ;

        }


}
@实体
@表(name=“创建日期”)
@命名查询({
@NamedQuery(name=“creationDate.findById”,query=“从creationDate c中选择不同的c左连接获取c.n”+
“left join fetch c.scheduleRotationChild s,其中c.dateId=:i”)
})
公共类CreationDate实现了可序列化{
私有静态最终长serialVersionUID=1648102358397071136L;
私有数据ID;
@身份证
@生成值(策略=标识)
@列(name=“DATE\u ID”)
public int getDateId(){
返回日期ID;
}
public void setDateId(int dateId){
this.dateId=dateId;
}
私人约会;
@列(name=“特定日期”)
公开日期GetSpecificularDate(){
返回特定日期;
}
公共无效设定特别日期(日期特别日期){
this.particularDate=particularDate;
}
私有int版本;
@版本
@列(name=“VERSION”)
public int getVersion(){
返回版本;
}
公共无效设置版本(int版本){
this.version=版本;
}
私人约会孩子选择日期;
@时态(TemporalType.DATE)
@列(name=“儿童入学日期”)
公共日期getChildGoSchoolDate(){
返回childGoSchoolDate;
}
public void setChildGoSchoolDate(日期childGoSchoolDate){
this.childGoSchoolDate=childGoSchoolDate;
}
私人日期儿童入院日期;
@时态(TemporalType.DATE)
@列(name=“儿童入学日期”)
公开日期GetChildApprovisionDate(){
返回儿童入院日期;
}
public void setChildAdmissionDate(日期childAdmissionDate){
this.childAdmissionDate=childAdmissionDate;
}
private Set institution=new HashSet();
@ManyToMany(fetch=FetchType.LAZY)
@Cascade(org.hibernate.annotations.CascadeType.ALL)
@JoinTable(name=“CREATIONDATE_INSTITUTION”,
joinColumns=@JoinColumn(name=“DATE\u ID”),
inverseJoinColumns=@JoinColumn(name=“INSTITUTION\u ID”))
公营机构(){
返回机构;
}
公共机构(Set institutionSet){
this.institution=institutionSet;
}
私有列表scheduleRotationChild=新ArrayList();
@OneToMany(fetch=FetchType.EAGER,orphan=true)
@Cascade(org.hibernate.annotations.CascadeType.ALL)
@JoinTable(name=“SRC_DATE”,
joinColumns=@JoinColumn(name=“DATE\u ID”),
inverseJoinColumns=@JoinColumn(name=“SRC_ID”))
公共列表getScheduleRotationChild(){
返回scheduleRotationChild;
}
公共无效setScheduleRotationChild(
列表scheduleRotationChild){
this.scheduleRotationChild=scheduleRotationChild;
}
公共机构(集合机构){
设置机构(机构);
}
公共无效地址(机构列表){
setScheduleRotationChild(SRC机构);
}
公共字符串toString(){
返回“\n”+“ID:“+dateId+”\n
+аааa:“+特定日期+”\n”
+“Биццццццицциццициц,Гц:“+childgosch
+“аааПаааааааааааааа107;
}
}

我希望这能向你们澄清我的问题。谢谢。

路径
属性
creationDate.specialDate
中,可能应该是
creationDate.specialDate


确保您的
CreationDate
对象具有正确的属性getter方法
#getspecialDate()
您的
表单:label
表单:input
标记中的
路径
值应与
表单:表单
中引用的命令对象相关。换句话说,
path
值应该是
creationDate
对象类的属性名。基本上只需删除
creationDate.
前缀,就可以得到以下结果:

<form:form  commandName="creationDate" method="GET" action="add">

<form:label path="particularDate">Particular Date</form:label>
<form:input path="particularDate" />

<form:label path="childGoSchoolDate">Child go to School</form:label>

特定日期
孩子上学

假设
creationDate
类具有名为
specialDate
childGoSchoolDate
的属性(带有getter/setter),我也遇到了同样的问题,但问题是我没有生成getter和setter,我手动将它们写下来。我所有的道路和方法都是正确的。因此,我删除了手动编写的getter和setter方法,并使用eclipse生成它们。我不理解它背后的逻辑,但这解决了我的问题。

命令
类与表单标记中提到的path变量一起丢失。

对于bean,重要的是为getter提供正确的名称。比如说,如果某个类将您的类视为bean并希望访问属性boxType,那么必须提供一个不带参数的getter getBoxType()。有一份关于获取者姓名的合同。“get”+大写字母(B)+物业名称的其余部分。您可能有一个公共属性boxType,但就bean而言,它是无用的。您需要从该fie返回值
<form:form  commandName="creationDate" method="GET" action="add">

<form:label path="particularDate">Particular Date</form:label>
<form:input path="particularDate" />

<form:label path="childGoSchoolDate">Child go to School</form:label>