In my entity:
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true, nullable=false)
private int tId;
....
public int getTId() {
return this.tId;
}
public void setTId(int tId) {
this.tId = tId;
}
And code in my JSF page:
<ui:repeat value="#{techCat.techsOfCat}" var="post">
<h:outputText value="#{post.getTId()}"/>
...
</ui:repeat>
The result is good. But if i code:
<ui:repeat value="#{techCat.techsOfCat}" var="post">
<h:outputText value="#{post.tId}"/>
...
</ui:repeat>
I faced an error:
value="#{post.tId}": The class 'model.Technology' does not have the property 'tId'.
I really don't understand that error. Can you explain to me? Thanks
The error means that correct getters and setters could not be located for your property. The correct syntax for your getter and setter should be:
public int gettId() {
return tId;
}
public void settId(int tId) {
this.tId = tId;
}
If you are not sure- always use code generation for your getters and setters.
If you are interested in the specific convention, your getter and setter will relate to TId
not tId
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With