±Û¾´ÀÌ :³²Áظð 1998³â 12¿ù 18ÀÏ 15:00:37
In Reply to: ³²Áظð´Ô º¸¼¼¿ä. posted by Á¤Çý¿ø on 1998³â 12¿ù 18ÀÏ 11:06:52:
Á¦°¡ ÇÑ ¼Ò½º¸¦ º¸³»µå¸³´Ï´Ù.
Ŭ¶óÀ̾ðÆ®ÀÇ ÈÀÏ ¿äû (¸µÅ© Ŭ¸¯,¹öưŬ¸¯)À»
¼ºí¸´ÀÌ ¹Þ¾Æ¼ ÈÀÏÀÇ ³»¿ëÀÇ ÀÀ´äÇÏ´Â ¼Ò½º
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
try
{
String filename="junmo.txt";
String filepath="c:\\";
byte b[]=new byte[1024];
File file=new File(filepath,filename);
FileInputStream fin=new FileInputStream(file );
res.setContentType("application/smnet");
res.setHeader("Content-
Disposition","attachment;
filename="+filename+";");
ServletOutputStream
out=res.getOutputStream();
int numRead = fin.read(b);
while (numRead != -1) {
out.write(b, 0, numRead);
numRead = fin.read(b);
}
out.close();
} catch(Exception e)
{ new PrintStream(res.getOutputStream()).println(e.toString());
}