首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jsp中的PropertyNotFoundException

jsp中的PropertyNotFoundException
EN

Stack Overflow用户
提问于 2015-06-22 05:40:53
回答 2查看 80关注 0票数 1

我的应用程序中有这个错误吗?

代码语言:javascript
复制
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)

这是我的MOH731.java

代码语言:javascript
复制
@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;
}

您的帮助将不胜感激。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-06-22 05:42:42

你的getter & setter的名字是错的。

按照惯例,这必须是:

代码语言:javascript
复制
public Integer getSurvey_id() {
   return survey_id;
}

public void setSurvey_id(Integer survey_id) {
   this.survey_id=survey_id;
}
票数 1
EN

Stack Overflow用户

发布于 2015-06-22 05:52:16

您的getter和setter命名约定应该与Id属性相同。

要么将private int survey_id;更改为private int Id;

代码语言:javascript
复制
public Integer getId() {
return survey_id;
}

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

代码语言:javascript
复制
public Integer getSurvey_id() {
   return survey_id;
}

public void setSurvey_id(Integer survey_id) {
   this.survey_id=survey_id;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30972739

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档