设为首页收藏本站
开启辅助访问
切换到宽版

创星网络[分享知识 传递快乐]

 找回密码
 立即注册

QQ登录

只需一步,快速开始

用新浪微博登录

只需一步,快速搞定

搜索
查看: 2871|回复: 0
打印 上一主题 下一主题

JSP写文件代码

[复制链接]

我玩的应用:

跳转到指定楼层
楼主
发表于 2012-12-13 19:54:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. <%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>


  2. <%@ page import="java.io.*" %>

  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5.   <head>
  6.    
  7.     <title></title>
  8. <meta http-equiv="pragma" content="no-cache">
  9. <meta http-equiv="cache-control" content="no-cache">
  10. <meta http-equiv="expires" content="0">   
  11. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  12. <meta http-equiv="description" content="This is my page">
  13. <!--
  14. <link rel="stylesheet" type="text/css" href="styles.css">
  15. -->
  16.     <link href="css/common_1.css" rel="stylesheet" type="text/css" />
  17.    <link rel="SHORTCUT ICON" href="../favicon.ico" />
  18.    
  19.    <style type="text/css">
  20. <!--
  21. .STYLE2 {font-size: 12px}
  22. -->
  23.    </style>
  24. </head>
  25.   
  26.   <body>

  27.       <%

  28.    String path_in = "";
  29.    String content = "";

  30.    path_in = request.getRealPath("/")+"admin"+File.separator+"manage_customer_details_edit.jsp";

  31.   
  32.    try
  33.    {
  34.    PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter
  35.    (path_in)));
  36.    writer.println(
  37.    "<%"
  38.    +"@ page contentType=/"text/html; charset=gbk/" language=/"java/" import=/"java.sql.*/" errorPage=/"/" %"
  39.    +">");
  40.    writer.println("<%"+"@ page import=/"cn.com.cxweb.pc.db.databean/" %"+">");
  41.     writer.println("<%"+"@include file=/"const.jsp/"%"+">");

  42.    
  43.    
  44.    writer.close();
  45.    out.println("已经把内容写入到文档"+path_in);
  46.    }
  47.    catch(Exception e)
  48.    {
  49.    out.println(e);
  50.    e.printStackTrace();
  51.    }
  52.    
  53.    
  54.    %>
  55.      
  56.         
  57.    </body>
  58. </html>
复制代码
----------------
发现输出%>时,需要分开
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|创星网络 ( 苏ICP备11027519号|网站地图  

GMT+8, 2024-9-22 05:27 , Processed in 0.077373 second(s), 22 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表