易截截图软件、单文件、免安装、纯绿色、仅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',' ......

JSP内置对象之request

HTTP 通信协议是客户与服务器之间一种提交(请求) 信息与响应信息
(request/respone)的通信协议。在JSP 中,内置对象request 封装了用户提交的信息,
那么该对象调用相应的方法可以获取封装的信息,即使用该对象可以获取用户提交的信
息。
客户通常使用HTML 表单向服务器的某个JSP 页面提交信息,表单的一般格式是: ......

仿百度ajax搜索提示(jsp)

<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>index</title>
<meta http-equiv="pragma" content="no-cache"&g ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号