<%@page import="java.sql.*"%>
<%@page import="com.binod.db.DBConnection"%>
<jsp:include page="header.jsp"/>
<center>
<div class="content">
<table border="1" cellpadding="5" class="full">
<tr>
<td>Cat_id</td>
<td>cat_name</td>
<td>
Cat_Path
</td>
</tr>
<%
ResultSet rs;
DBConnection db=new DBConnection();
db.open();
String query="Select * from `category`";
PreparedStatement preparedStatement =db.getPreparedStatement(query);
rs=preparedStatement.executeQuery();
while(rs.next()){
int cat_id=rs.getInt("cat_id");
String cat_name=rs.getString("cat_name");
String cat_path=rs.getString("cat_image");
System.out.println(cat_path);
%>
<tr>
<td><%=cat_id %></td>
<td> <%= cat_name %></td>
<td class="Images"><img src="<%= cat_path%>" alt="Image not found"/></td>
</tr>
<%
}
%>
</table>
</div>
</center>
<jsp:include page="footer.jsp"/>
MY控制檯輸出:存儲在數據庫中的圖像路徑
C:\用戶\ Binod \工作空間\店\圖片\類別\ b:C:\ Users \ Binod \ workspace \ shop \ Pictures \ Category \屏幕截圖(5).png C:\ Users \ Bbb.jpg C:\ Users \ Binod \ workspace \ shop \ Pictures \ Category \ bbb.jpg Binod \ workspace \ shop \ Pictures \ Category \屏幕截圖(5).png C:\ Users \ Binod \ workspace \ shop \ Pictures \ Category \ Screenshot( 5).png C:\ Users \ Binod \ workspace \ shop \ Pictures \ Category \ Screenshot(5).png C:\ Users \ Binod \ workspace \ shop \ Pictures \ Category \ Screenshot(5).png C :\ Users \ Binod \ workspace \ shop \ Pictures \ Category \ Screenshot(6).png
您是否將您的機器用作客戶端以及服務器? – Darshit
控制檯意味着瀏覽器控制檯?您可以在渲染jsp的時候爲瀏覽器控制檯添加更多細節或截圖嗎? – Ankit
我不認爲系統路徑可以用於域。你想要'/ shop/Pictures/Category/file.jpg'或'http:// localhost/shop/Pictures/Category/file.jpg'。 – hungerstar