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

SetCharacterEncodingFilter jsp字符过滤器

package com.demo.filter;
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.FilterChain;
import java.io.IOException;
public class SetCharacterEncodingFilter implements Filter {
  protected FilterConfig filterConfig;
  protected String encodingName;
  protected boolean enable;
  public SetCharacterEncodingFilter() {
    this.encodingName = "GBK";
    this.enable = false;
  }
  public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
  }
  public void doFilter(ServletRequest request,
                       ServletResponse response,
                       FilterChain chain)
                    throws IOException, ServletException {
    request.setCharacterEncoding("GBK");
    response.setCharacterEncoding("GBK");
    chain.doFilter(request, response);
  }
  public void destroy() {
  }
}
————————————————————————————————————————————
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.


相关文档:

jsp中的注释

源代码注释格式
1、JSP
在jsp页面中注释有两种
Html代码
<!--  注释内容 -->  
<%--  注释内容 --%>  
<!-- 注释内容 -->
<%-- 注释内容 --%>
 
今天遇到个问题,采用第一种注释方式,注释位置在jsp文件最前面会影响到导入的 ......

jsp页面查询的数据导出到excel(二)


java导入导出excel操作(jxl)(2)
关键字: java导入导出excel操作(jxl)(2)(
高级操作
一、 数据格式化
在Excel中不涉及复杂的数据类型,能够比较好的处理字串、数字和日期已经能够满足一般的应用。
字串格式化
字符串的格式化涉及到的是字体、粗细、字号等元素,这些功能主要由WritableFont和WritableCellFormat ......

jsp中读取properties文件

jsp中读取properties文件,并把值设到js变量中:
web_stderr.properties文件内容:
common.username.error.null = UserName can not be null.
common.username.error.invalid = UserName is invalid.
common.password.error.null = Password can not bu null.
common.password.error.invalid = Password is invalid.
......

JSP处理session与cookie研究三

定义一个session变量
session.setAttribute("user_name","joan");
读取一个session的值:
String your_name=session.getAttribute("user_name");
判断一个session是否存在应用:
if((String)session.getAttribute("user_id")==null)
{
out.print("yes");
}
else
{
out.print("no");
}
写入一个cook ......

预编译JSP的ANT脚本 (兼容tomcat5和tomcat6)

<project name="jspToServletToClass" default="jsp2servlet2class" basedir=".">

<!-- set global properties for this build -->
<property environment="env" />
<property name="src" location="F:\JspC\src\" />
< ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号