example4_6.jsp
来自「可以让初学者有一个感性的认识」· JSP 代码 · 共 36 行
JSP
36 行
<HTML>
<%@page contentType="text/html;charset=GB2312"%>
<%@page import="java.io.*"%>
<BODY bgcolor=cyan><Font size=3>
<% File dir=new File("d:/Tomcat/webapps/root","Students");
dir.mkdir();
File f=new File(dir,"hello.txt");
try
{
FileOutputStream outfile=new FileOutputStream(f);
BufferedOutputStream bufferout=new BufferedOutputStream(outfile);
byte b[]="你们好!很高兴认识你们!<BR>nice to meet you".getBytes();
bufferout.write(b);
bufferout.flush();
bufferout.close();
outfile.close();
FileInputStream in=new FileInputStream(f);
BufferedInputStream bufferin=new BufferedInputStream(in);
byte c[]=new byte[90];
int n=0;
while((n=bufferin.read(c))!=-1)
{
String temp=new String(c,0,n);
out.print(temp);
}
bufferin.close();
in.close();
}catch(IOException e){}
%>
</FONT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?