简体   繁体   English

jsp中的PropertyNotFoundException

[英]PropertyNotFoundException in jsp

Am getting this error in my application 我的应用程序中出现此错误

javax.el.PropertyNotFoundException: Property 'survey_id' not found on type com.moh.forms.MOH731
javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:229)
javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:206)
javax.el.BeanELResolver.property(BeanELResolver.java:317)
javax.el.BeanELResolver.getValue(BeanELResolver.java:85)

This is my MOH731.java 这是我的MOH731.java

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int survey_id;

public MOH731 (int survey_id, String uname)

@Override
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
public Integer getId() {
return survey_id;
}

public void setId(Integer survey_id) {
this.survey_id=survey_id;
}

Your help will be highly appreciated 非常感谢您的帮助

The name of your getter & setter is wrong. 您的获取器和设置器的名称错误。

By convention it must be: 按照惯例,它必须是:

public Integer getSurvey_id() {
   return survey_id;
}

public void setSurvey_id(Integer survey_id) {
   this.survey_id=survey_id;
}

You getter and setter naming convention should be as per the Id property 您的getter和setter命名约定应与Id属性相同

Either change private int survey_id; 要么更改private int survey_id; to private int Id; private int Id;

Or 要么

public Integer getId() {
return survey_id;
}

public void setId(Integer survey_id) {
this.survey_id=survey_id;
}

to

public Integer getSurvey_id() {
   return survey_id;
}

public void setSurvey_id(Integer survey_id) {
   this.survey_id=survey_id;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM