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.
相关文档:
java导入导出excel操作(jxl)(2)
关键字: java导入导出excel操作(jxl)(2)(
高级操作
一、 数据格式化
在Excel中不涉及复杂的数据类型,能够比较好的处理字串、数字和日期已经能够满足一般的应用。
字串格式化
字符串的格式化涉及到的是字体、粗细、字号等元素,这些功能主要由WritableFont和WritableCellFormat ......
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.
......
在应用程序开发的时候分页有两种:真分页和假分页,假分页要把所有数据先提取出来放到一个list集合里或者静态变量中。真分页则是需要用到几行数据再从数据库中提取出来放把需要显示的数据放到list集合里。但无论真分页假分页pager-taglib都可以很好的为我们进行处理。
1.下载pager-taglib
下载地 ......
Jsp常用技巧:图片验证码
2009年10月30日 星期五 21:06
思路
:
图片验证码的实现主要的技术点是如何生成一个图片。生成图片可以使用java.awt包下的类来实现。我们先写一个简单的生成图片的程序HelloImage.java。以下是代码部分。
package com.vogoal.test;
import java.awt.Color;
import
java.awt.Graphics;
imp ......
<project name="jspToServletToClass" default="jsp2servlet2class" basedir=".">
<!-- set global properties for this build -->
<property environment="env" />
<property name="src" location="F:\JspC\src\" />
< ......