servletencoding.java~1~
来自「一个很不错的电子商务后台管理系统 这是一个电子商务网站的后台管理系统 要」· JAVA~1~ 代码 · 共 34 行
JAVA~1~
34 行
package xian.bin.servlet;import javax.servlet.*;import javax.servlet.http.*;import java.io.*;import java.util.*;public class ServletEncoding extends HttpServlet implements Filter { private FilterConfig filterConfig; //Handle the passed-in FilterConfig public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; } //Process the request/response pair public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) { try { filterChain.doFilter(request, response); request.setCharacterEncoding("gb2312"); } catch(ServletException sx) { filterConfig.getServletContext().log(sx.getMessage()); } catch(IOException iox) { filterConfig.getServletContext().log(iox.getMessage()); } } //Clean up resources public void destroy() { }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?