jsp网站开发四“酷”全书原码

源代码在线查看: photo.jsp

软件大小: 19310 K
上传用户: rentianchou
关键词: jsp 网站
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
								
					FileInputStream is = null;
					DataInputStream in = null; 
				try{
					String photo = (new oa.main.DealString()).toGBK((String)request.getParameter("photo"));
				
					photo = oa.main.ParentBean.FilesPath + "photo/" + photo;
					//photo = (new oa.main.DealString()).Replace(photo,"\\","/");
					is = new FileInputStream(photo);
					in = new DataInputStream(is);
				
					response.reset(); 
					if(photo.indexOf("gif")!=-1)response.setContentType("image/gif");
					else if(photo.indexOf("jpg")!=-1)response.setContentType("image/jpg");
					else if(photo.indexOf("png")!=-1)response.setContentType("image/png");
					else if(photo.indexOf("bmp")!=-1)response.setContentType("image/bmp");
					else if(photo.indexOf("jpeg")!=-1)response.setContentType("image/jpeg");
					byte[] b = new byte[1024]; 
					int len; 
					while((len=in.read(b)) >0) 
					response.getOutputStream().write(b,0,len); 	
				}
				catch(IOException ioe){}//System.out.println(ioe);}
				finally{
					if(in!=null)	in.close();
					if(is!=null)	is.close();
				}
				%>			

相关资源