我无法让jsp在book对象中找到title的属性,即使它是全部公开的(这是我能找到的人唯一的问题)
Book book = new Book(bookID, title, author);
BookDB.insert(book);
request.setAttribute("Book", book);
调用然后调用:
${Book.title}
在jsp文件中
这是目标代码:
包裹业务;
公共课书{
public static String title, author;
public static int bookID;
public Book(int bookID, String title, String author) {
this.bookID = bookID;
this.title = title;
this.author = author;
}
public static String getTitle() {
return title;
}
public static void setTitle(String title) {
Book.title = title;
}
public static String getAuthor() {
return author;
}
public static void setAuthor(String author) {
Book.author = author;
}
public static int getBookID() {
return bookID;
}
public static void setBookID(int bookID) {
Book.bookID = bookID;
}
}