各位前辈帮我看一下这个问题,谢谢!

japanvincent japanvincent 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312" import="java.io.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>???????</title>
</head>
<body>
<%
File filePath=new File("F:/shopping/ch9/WebContent");
File sourceFile=new File(filePath,"data1.txt");
File targetFile=new File(filePath,"data2.txt");
String temp;
try{
BufferedReader source=new BufferedReader(new FileReader(sourceFile));
BufferedWriter target=new BufferedWriter(new FileWriter(targetFile));
while((temp=source.readLine())!=null)
{
target.write(temp);
target.newLine();
target.flush();
}
out.println("<br>"+"复制完成");
source.close();
target.close();
}


catch(IOException E)
{
out.println("<br>"+"IOcuowu ");
}

%>

</body>
</html>
以上是我按照书上写的JSP代码,运行以后的结果是 IOcuowu。请问这是怎么回事啊?还有target.write(temp);
target.newLine();target.flush();这三段代码是什么意思啊?
...全文
评论 10
收藏 已收藏
分享
返回顶部
japanvincent
Web 开发 81,107 成员 341,720 内容