JSP写文件代码
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %><%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link href="css/common_1.css" rel="stylesheet" type="text/css" />
<link rel="SHORTCUT ICON" href="../favicon.ico" />
<style type="text/css">
<!--
.STYLE2 {font-size: 12px}
-->
</style>
</head>
<body>
<%
String path_in = "";
String content = "";
path_in = request.getRealPath("/")+"admin"+File.separator+"manage_customer_details_edit.jsp";
try
{
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter
(path_in)));
writer.println(
"<%"
+"@ page contentType=/"text/html; charset=gbk/" language=/"java/" import=/"java.sql.*/" errorPage=/"/" %"
+">");
writer.println("<%"+"@ page import=/"cn.com.cxweb.pc.db.databean/" %"+">");
writer.println("<%"+"@include file=/"const.jsp/"%"+">");
writer.close();
out.println("已经把内容写入到文档"+path_in);
}
catch(Exception e)
{
out.println(e);
e.printStackTrace();
}
%>
</body>
</html>----------------
发现输出%>时,需要分开
页:
[1]