1 图片已经上传,数据库也获得正确的图片地址
2 在页面上也可以查看到正确的图片地址
3 重新启动一下tomcat 图片就可以显示
这是什么问题
前端页面
response.setHeader("Pragma", "No-Cache");
response.setHeader("Cache-Control", "No-Cache");
response.setDateHeader("Expires", 0);
BookDao bookDao = new BookDao();
List list = new ArrayList<>();
List item = new ArrayList();
list = bookDao.listBookInfo();
%>
for (Books books : list
) {
%>
}
%>
Dao
public List listBookInfo() {
List list = new ArrayList();
try {
String sql = "SELECT * FROM books WHERE isLend=1";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
Books books = new Books();
books.setBookid(rs.getLong("bookId"));
books.setBookname(rs.getString("bookName"));
books.setCbs(rs.getString("cbs"));
books.setWriter(rs.getString("writer"));
books.setIslend(rs.getLong("isLend"));
books.setItems(rs.getString("items"));
books.setDate(rs.getTimestamp("date"));
books.setImgPath(rs.getString("imgpath"));
list.add(books);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}