jsp生成html静态页面代码
<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm";
out.print(filePath);
String templateContent="";
FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件
//int lenght = fileinputstream.available();
byte bytes[] = new byte[1024];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
out.print("以下是模板内容:<br>"+templateContent+"<br> 以下是置换以后的html内容<br><hr>");
templateContent=templateContent.replaceAll("#title#","文章标题");
templateContent=templateContent.replaceAll("#author#","作者是谁");//替换掉模块中相应的地方
templateContent=templateContent.replaceAll("#content#","文章内容");
// 根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileame = String.valueOf(calendar.getTimeInMillis()) +".html";
fileame = request.getRealPath("/")+fileame;//生成的html文件保存路径
out.print(templateContent);
FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件输出流
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
%>
相关文档:
Crescent Eve(http://www.kashim.com/eve/
)是免费的HTML,CSS的编辑器.
和记事本类似,非常简洁.
主要有以下4个功能
HTML的tag输入提示
tag属性的输入提示
HTML的语法检查
HTML预览
在编辑HTML画面时非常有用.
Crescent Eve是非常小的一个编辑器,操作也非常简 ......
JSP/Servlet的编码原理
关键字: jsp, servlet编码
首先,说说 JSP/Servlet 中的几个编码的作用
在 JSP/Servlet 中主要有以下几种设置编码的方式:
pageEncoding ="UTF-8"
contentType = "text/html;charset=UTF-8"
request.setCharacterEncoding("UTF-8")
response.setCharacterEncodin ......
最早使用的Frontpage和后来经常使用的Dreamweaver,现在已经很少使用了,而Adobe也已经收购了macromedia。有是有需要编辑一些简单的HTML文件,还是一些免费的轻量级的编辑器。
下面是我找到的一些,给需要的朋友们:
http://www.softpedia.com/get/Internet/WEB-Design/HTML-Editors/
http://www.skycn.com/sort/s ......
string str = a.ToString();
str = Regex.Replace(str, @"</?span[^>]*>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"&#[^>]*;", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"</?marquee[^>]*>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, ......
<OBJECT height="700" width="800" border="0" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"
>
<PARAM NAME="_Version" VALUE="65539">
<PARAM NAME="_ExtentX" VALUE="20108">
<PARAM NAME="_ExtentY" VALUE="10866">
<PARAM NAME="_StockProps" VALUE="0">
<PARA ......