java - Pictures cannot be displayed in jsp page
世界只因有你
世界只因有你 2017-06-14 10:50:51
0
1
864

1 The image has been uploaded, and the correct image address has been obtained from the database
2 You can also view the correct image address on the page
3 Restart tomcat and the image will be displayed

What is the problem

Front-end page

 <% 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 ) { %> 
图片不存在
<%=books.getBookname() + "( 书号:" + books.getBookid() + ")"%>
<%=books.getWriter()%> <%=books.getCbs()%>
<%=books.getItems()%>

<% } %>

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; }
世界只因有你
世界只因有你

reply all (1)
巴扎黑

According to what you said, there is a possibility that your pictures are still stored in the memory.
For example, your output stream is cached, but there is neither flush nor close in your code, and then restarting causes a forced flush.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!