Jonnie
Jonnie

Reputation: 25

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

@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

Upvotes: 1

Views: 114

Answers (2)

techPackets
techPackets

Reputation: 4516

You getter and setter naming convention should be as per the Id property

Either change private int survey_id; to 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;
}

Upvotes: 0

Jens
Jens

Reputation: 69505

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;
}

Upvotes: 1

Related Questions