易截截图软件、单文件、免安装、纯绿色、仅160KB

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();
%>


相关文档:

HTML 5 教程(一) 前言

       超文本标记语言(HTML)5 第一次向 HTML 中引入新的元素。新的结构元素包括 aside、figure 和 section。新的内联元素包括 time、meter 和 progress。新的内嵌元素有 video 和 audio。新的交互元素有 details、datagrid 和 command。  
  超文本标记语言(HTML)的开发到 ......

jsForm Html Form via JSON with jQuery

/* 1 construct html form 2 bind data to form 3 validate form data 4 collect data from form */  (function($){     var controlTypes = ['textbox','password',' ......

下拉框树,HTML代码

     很多时候,我们需要将下拉框里面的数据用树显示出来,这样会便于客户得到清晰的数据,而且比较直接,晾出以下HTML代码,可以直接复制到HTML代码里面运行!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-tran ......

JSP/Servlet的编码原理


JSP/Servlet的编码原理
关键字: jsp, servlet编码
首先,说说 JSP/Servlet 中的几个编码的作用 
在 JSP/Servlet 中主要有以下几种设置编码的方式:
pageEncoding ="UTF-8"
contentType = "text/html;charset=UTF-8"
request.setCharacterEncoding("UTF-8")
response.setCharacterEncodin ......

去除网站中HTML标签的正则表达式

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, ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号