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\"%"+">");
相关文档:
方法一:在servlet的init()方法中缓存数据
当应用服务器初始化servlet实例之后,为客户端请求提供服务之前,它会调用这个servlet的init()方法。在一个servlet
的生命周期中,init()方法只会被调用一次。通过在init()方法中缓存一些静态的数据或完成一些只需要执行一次的、耗时的操作,就可大大地提高系
统性能。
......
500错误,classnotfound异常,代码没有问题,数据库也没问题,打了补丁,装了驱动,但是在TOMCAT上找不到那个驱动而引发的错误。。。
解决办法:首选项设置里,MyRclipse->J2EE Project->Web Project->Deployment勾上那三个驱动。 ......
1,DateTime类型数字
以下是引用片段:
当前时间System.DateTime的=新System.DateTime的();
1.1小时分钟当前日期秒,当前时间= System.DateTime.Now;
1.2检查本年度廉政年= currentTime.Year;
1.3当前月份廉政个月= currentTime.Month;
1,4采取当天廉政天= currentTime.Day;&n ......
在Jsp和jsp中的javabean里面,"/"指的是tomcat所在的根路径,如果是在Windows下就是tomcat所在盘的盘符;而“.”指的是tomcat的bin目录所在的路径。
我猜想这是因为jsp代码都会被tomcat转为Servlet,而Servlet是在tomcat中访问的,所以jvm在运行Servlet时就认为目录是tomcat所在的目录。
Html中的“/&r ......
<%@ page contentType="text/html; charset=gbk" language="java" import="java.io.*" buffer="64kb" %>
<%
String path_in = "";
String content = "";
path_in = request.getRealPath("/")+"admin"+File.separator+ ......