コードでプロパティが見つからない例外に問題があります。public getter と setter を使用して適切な命名規則に従っていますが、それでも例外が発生し、その理由がわかりません。高低を投稿せずに解決策を探しました。私は何を間違っていますか?リストにアクセスしている可能性がありますか?
Java クラスの本:
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;
}
}
.jsp ファイルからのコード
<c:forEach var="tag" items="${book.tagList}">
<c:out value="${tag}" />
</c:forEach>
スローされた例外:
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'.