jsp从数据库中读取图片路径显示不出来
jsp代码:<imgsrc="show.jsp?number=<%=0%>&type=hjdg_image"border="0"/>show.jsp代码:Stringnu...
jsp代码:<img src="show.jsp?number=<%=0%>&type=hjdg_image" border="0"/>
show.jsp代码:
String num = request.getParameter("number");
int number = Integer.parseInt(num);
String type = request.getParameter("type");
if(type != null){
if(type.equals("hjdg_image")){
OutputStream outs = null;
try{
String dir = DBUtil.getHJDGImage(number);
} //try catch省略了
DBUtil.java代码:
public static String getHJDGImage(int mid){//根据编号得到图片路径
String result = null;
Connection con = getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
try{
pstmt = con.prepareStatement("select image_dir from hjdg_image where mid=?");
pstmt.setInt(1, mid);
rs = pstmt.executeQuery();
while(rs.next()){
String b = rs.getString("image_dir");
result=b;
}
}
运行后页面的图片还是显示叉叉,请问是哪一步出问题呢?本人新手,望详细解答,谢谢! 展开
show.jsp代码:
String num = request.getParameter("number");
int number = Integer.parseInt(num);
String type = request.getParameter("type");
if(type != null){
if(type.equals("hjdg_image")){
OutputStream outs = null;
try{
String dir = DBUtil.getHJDGImage(number);
} //try catch省略了
DBUtil.java代码:
public static String getHJDGImage(int mid){//根据编号得到图片路径
String result = null;
Connection con = getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
try{
pstmt = con.prepareStatement("select image_dir from hjdg_image where mid=?");
pstmt.setInt(1, mid);
rs = pstmt.executeQuery();
while(rs.next()){
String b = rs.getString("image_dir");
result=b;
}
}
运行后页面的图片还是显示叉叉,请问是哪一步出问题呢?本人新手,望详细解答,谢谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询