public class Servlet1
extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
//response.setContentType("image/gif;");
dbo d = new dbo();
java.io.InputStream pic = null;
java.io.OutputStream pw = null;
try{
//request.getParameter("id");
response.setContentType("image/gif;name=doskt.jpg");
pic=d.getBytes();
pw=response.getOutputStream();
byte[] b = new byte[4096];
int bt = pic.read(b);
while (bt != -1) {
pw.write(b, 0, bt);
bt = pic.read(b);
}
}
catch(Exception e){
System.out.println("doGet:" + e);
}
finally{
if(pic!=null){
pic.close();
}
}
/*out.println("<html>");
out.println("<head><title>Servlet1</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
out.println("</body></html>");*/
}