html
<%@ page contentType="text/html;charset=utf
<%@page import="cn
<%@page import="java
<%
//在這裡如果寫成“WEB
String filePath = request
out
String templateContent="";
FileInputStream fileinputstream = new FileInputStream(filePath);//讀取模塊文件
int lenght = fileinputstream
byte bytes[] = new byte[lenght ];
fileinputstream
fileinputstream
templateContent = new String(bytes);
int newsid=
newsCtl nCtl=new newsCtl();
news news=new news();
// newsImg newsimg=new newsImg();
//newsImgCtl nImgCtl=new newsImgCtl();
news=nCtl
//int rector=news
//String source=news
//String datetime=news
//int degree=news
//int companyid=news
String title=news
String content=news
if(title==null) title="";
//if(source==null) source="";
//if(datetime==null) datetime="";
if(content==null) content="";
templateContent=templateContent
templateContent=templateContent
// 根據時間得文件名
Calendar calendar = Calendar
String fileame = String
String file = "filename/"+String
fileame = request
out
FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件輸出流
byte tag_bytes[] = templateContent
//String username = "
//username = new String(username
fileoutputstream
fileoutputstream
response
//out
%>
模版頁面
template
<%@ page contentType="text/html;charset=utf
<html>
<head>
<title>jsp</title>
<meta http
<meta http
<meta http
<!
</head>
<body><!
id=oDownload style="BEHAVIOR: url(#default#download)" />
<SCRIPT>
function topOnDownloadDone(downDate){
showTop
}
oDownload
</SCRIPT>
<!
<TABLE width="
<tr><td valign="top" bgcolor="#FFFFFF"><div align="center" class="d
<tr><td valign="top" bgcolor="#FFFFFF"><div align="center" class="d
</TABLE>
<!
<SCRIPT>
function bottomOnDownloadDone(downDate)
{
showBottom
}
oDownload
</SCRIPT><!
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20314.html