从服务器显示图像

时间:2014-04-08 12:08:54

标签: java image file-upload

我想显示用户个人资料以及用户图片。我使用以下代码

成功将图像上传到服务器
String name = new File(item.getName()).getName();
            teacherInfo.setPhoto(name);
            try {
                File fileSaveDir = new File(uploadFilePath);
                if (!fileSaveDir.exists()) {
                    fileSaveDir.mkdirs();
                }
                item.write( new File(uploadFilePath + File.separator + name));
                System.out.println("Uploaded Successfully");
            } catch (Exception e) {
                e.printStackTrace();
            } 

现在我想显示存储在uploadFilePath中的图像,这里uploadFilePath是eclipse的服务器路径。任何人都可以帮助我。

1 个答案:

答案 0 :(得分:0)

<img src="<%=uploadFilePath%>/<c:out value='${filename}'/>" width="114" height="110" style="float: left;"/>
相关问题