求高手:jsp 中点击图片,弹出新窗口,在新窗口中放大预览该图片 急求,在线等
<%!publicstaticvoidreadLocalPicture(Stringpath,OutputStreamoutput,HttpServletRequestr...
<%! public static void readLocalPicture(String path, OutputStream output, HttpServletRequest req)
{InputStream is = null;
String realPath = req.getRealPath(path)
try
{ File defaultPicFile = new File(realPath);
if(defaultPicFile.exists())
{ is = new FileInputStream(defaultPicFile);
byte[] bytes = new byte[1024];
while (is.read(bytes) != -1)
{ output.write(bytes);} } }
catch(Exception e)
{}
finally
{ try
{if (is != null)
{ is.close(); }
} catch (IOException e)
{ e.printStackTrace(); }} }
%><% response.setContentType("image/jpeg");
String defaultPicPath = "images/kbs/mobile/ceDMjvWwejnB6.jpg";
readLocalPicture(defaultPicPath,response.getOutputStream(), request);%>
新的窗口中图片显示红叉叉,打不开,高手帮看一下问题在哪?或者有好的代码也行。谢谢! 展开
{InputStream is = null;
String realPath = req.getRealPath(path)
try
{ File defaultPicFile = new File(realPath);
if(defaultPicFile.exists())
{ is = new FileInputStream(defaultPicFile);
byte[] bytes = new byte[1024];
while (is.read(bytes) != -1)
{ output.write(bytes);} } }
catch(Exception e)
{}
finally
{ try
{if (is != null)
{ is.close(); }
} catch (IOException e)
{ e.printStackTrace(); }} }
%><% response.setContentType("image/jpeg");
String defaultPicPath = "images/kbs/mobile/ceDMjvWwejnB6.jpg";
readLocalPicture(defaultPicPath,response.getOutputStream(), request);%>
新的窗口中图片显示红叉叉,打不开,高手帮看一下问题在哪?或者有好的代码也行。谢谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询