I am having difficulty with a property not found exception in my code. I have followed proper naming conventions with public getters and setters but still receive the exception and I am not sure why. I have searched for a solution without posting high and low. What am I doing wrong? Could it be that I am accessing a list?
Java class Book:
public class Book {
private String isbn13; // International Standard Book Number, unique
private String title;
private String author;
private LocalDate publishDate; // Date of publish to the website
private double price;
private byte[] content;
private ArrayList<String> tagList;
public ArrayList<String> getTagList() {
return tagList;
}
public void setTagList(ArrayList<String> tagList) {
this.tagList = tagList;
}
// Constructor used when no date is specified
public Book(String isbn, String title, String author, byte[] content) {
this.isbn13 = isbn;
this.title = title;
this.author = author;
this.publishDate = LocalDate.now();
this.content = content;
}
// Constructor used when a date is specified
public Book(String isbn, String title, String author, byte[] content, LocalDate publishDate) {
this.isbn13 = isbn;
this.title = title;
this.author = author;
this.publishDate = publishDate;
this.content = content;
}
// Default constructor
public Book() {
this.isbn13 = null;
this.title = null;
this.author = null;
this.publishDate = LocalDate.now();
this.content = null;
}
public String getIsbn13() {
return isbn13;
}
public void setIsbn13(String isbn13) {
this.isbn13 = isbn13;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public LocalDate getPublishDate() {
return publishDate;
}
public void setPublishDate(LocalDate publishDate) {
this.publishDate = publishDate;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public byte[] getContent() {
return content;
}
public void setContent(byte[] content) {
this.content = content;
}
}
code from .jsp file
<c:forEach var="tag" items="${book.tagList}">
<c:out value="${tag}" />
</c:forEach>
exception thrown:
org.apache.jasper.JasperException:
org.apache.jasper.el.JspPropertyNotFoundException:
/bookPublishingHome.jsp(50,10) '${book.tagList}' The class
'examples.pubhub.model.Book' does not have the property 'tagList'.