社区
Web 开发
帖子详情
怎样将Jsp网页内容生成Html代码,加快访问速度
prettyheart
2006-03-02 08:10:19
我想将Jsp网页生成html代码,加快访问速度,我知道怎样把Jsp读取出来,生成JSP文件,但我清楚怎样处理他们的链接关系。
请问怎么做?
...全文
169
4
打赏
收藏
怎样将Jsp网页内容生成Html代码,加快访问速度
我想将Jsp网页生成html代码,加快访问速度,我知道怎样把Jsp读取出来,生成JSP文件,但我清楚怎样处理他们的链接关系。 请问怎么做?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
mms_buy
2006-03-02
打赏
举报
回复
标准型彩信平台-只需2万。全网或省网多家SP正常运行2年以上,性能稳定、可靠,服务周到。标准型包括数据字典、后台管理系统和底层通讯系统等,提供租用通道,实现SP虚拟运营,并免费协助同移动接口测试,还赠送一年的免费技术支持服务。
http://www.shuziren.cn 现有大量彩图/铃声[有版权]出售。另外,如果您有网站,欢迎互相做链接;如果您有成功客户,可实现20%的高额报酬。双方共盈,是我们追求的目标!有意者请加QQ382907629/SP联盟群13195071。
网址:http://www.shuziren.cn
邮件:shuziren.cn@shuziren.cn;mms_buy@yahoo.com.cn 电话:0752-2671654
cnyxlxw
2006-03-02
打赏
举报
回复
mark
crazy_he
2006-03-02
打赏
举报
回复
我只是搜索了一下以前的帖子,一下代码仅供参考
为了减轻服务器压力,将原来的文章管理系统由JSP文件的从数据库中取数据显示改为由jsp生成静态html文件后直接访问html文件。下面是一个简单的示例
1.buildhtml.jsp
<%@ page contentType="text/html; charset=gb2312" import="java.util.*,java.io.*"%>
<%
try{
String title="This is Title";
String content="This is Content Area";
String editer="LaoMao";
String filePath = "";
filePath = request.getRealPath("/")+"test/template.htm";
//out.print(filePath+"<br/>");
String templateContent="";
FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
//out.print(templateContent);
templateContent=templateContent.replaceAll("###title###",title);
templateContent=templateContent.replaceAll("###content###",content);
templateContent=templateContent.replaceAll("###author###",editer);//替换掉模块中相应的地方
//out.print(templateContent);
// 根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileame = String.valueOf(calendar.getTimeInMillis()) +".html";
fileame = request.getRealPath("/")+fileame;//生成的html文件保存路径
FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件输出流
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
}
catch(Exception e){
out.print(e.toString());
}
%>
2. template.htm
<html>
<head>
<title>###title###</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css.css" rel=stylesheet type=text/css>
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td align="center">###title###</td>
</tr>
<tr>
<td align="center">author:###author### </td>
</tr>
<tr>
<td>###content###
</td>
</tr>
</table>
</body>
</html>
T_space
2006-03-02
打赏
举报
回复
变动为静,啊哦
Jsp
-To-
Html
.rar_
Jsp
To
Html
_java
html
_
jsp
html
_
jsp
to ht_
jsp
网站
jsp
-网站的静态页面
生成
方案, 比较实用
jsp
文件转换成静态的
html
NULL 博文链接:https://cuiquanmao.iteye.com/blog/704282
JSP
第10章静
JSP
第10章静态网页素材,了斯柯达积分;lsdlas
jsp
生成
静态页面资料.rar
jsp
生成
静态页面资料
jsp
生成
静态页面资料
Web组件-Ⅱ——
JSP
初步基础
Web组件-Ⅱ——
JSP
初步基础让你更快学会
Web 开发
81,122
社区成员
341,744
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章