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

jsp转静态例子

1个Servlet:SetCharacterEncodingFilter.java
 
package com.util;
import java.io.IOException;
import javax.servlet.*;
public class SetCharacterEncodingFilter  implements Filter{
 protected String encoding = null;
 protected FilterConfig filterConfig = null;
 protected boolean ignore = true;
 public void destroy()
 {
    this.encoding = null;
    this.filterConfig = null;
 }
 public void doFilter(ServletRequest request, ServletResponse response,
     FilterChain chain) throws IOException, ServletException
 {
    if (ignore || (request.getCharacterEncoding() == null))
    {
     String encoding = selectEncoding(request);
     if (encoding != null)
      request.setCharacterEncoding(encoding);
    }
    chain.doFilter(request, response);
 }
 public void init(FilterConfig filterConfig) throws ServletException
 {
    this.filterConfig = filterConfig;
    // 获取初始化参数
    this.encoding = filterConfig.getInitParameter("encoding");
    String value = filterConfig.getInitParameter("ignore");
    if (value == null)
    {
     this.ignore = true;
    } else if (value.equalsIgnoreCase("true"))
    {
     this.ignore = true;
    } else if (value.equalsIgnoreCase("yes"))
    {
     this.ignore = true;
    } else
     this.ignore = false;
 }
 protected String selectEncoding(ServletRequest request)
 {
    return (this.encoding);
 }
}
一个过滤器 JspFilter.java:
package com.util;
import java.io.IOException;
import jav


相关文档:

JSP中的COOKIE操作


JSP中的COOKIE操作
Cookie概念:
    Cookie的格式实际上是一段纯文本信息, 由服务器随着网页一起发送到客户端, 并保存在客户端硬盘中指定的目录的. 大家都传说Cookie会造成严重的安全威胁什么的, 其实不是这么回事情. 服务器读取Cookie的时候, 只能够读取到这个服务 ......

JSP留言管理系统 (附加用户权限功能)

JSP留言管理系统 (附加用户权限功能)
1.游客可以查看通过审核的留言;
2.普通用户登录后可以发表留言,修改密码;
3.管理员登录后可以审核、修改、删除留言;
4.超级管理员登录后可以管理用户,删除用户、修改密码、更改权限。
此留言管理系统包含以下文件:
1.首页(index.jsp):按发表时间倒序显示留言内容,不同权 ......

JSP中与路径相关的常用的几个方法


http:/localhost/123/jsp/test.jsp:
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logi ......

JSP 隐式对象

·pageContext:提供对页面属性的访问。
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
pageContext.setAttribute("basePath",basePath);
%>
使用:
${pageScope}
 
·reques ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号