資源簡介
基于web的在線聊天系統源碼,MVC框架設計開發,可用作畢業設計,課程設計。
代碼片段和文件信息
/*
?*?To?change?this?template?choose?Tools?|?Templates
?*?and?open?the?template?in?the?editor.
?*/
package?com.wgh.filter;
import?java.io.IOException;
import?javax.servlet.*;
public?class?CharacterEncodingFilter?implements?Filter{
??
??protected?String?encoding?=?null;
???
?protected?FilterConfig?filterConfig?=?null;
?
???public?void?init(FilterConfig?filterConfig)?
throws?ServletException?{
???????
???????this.filterConfig?=?filterConfig;
??
??????this.encoding?=?filterConfig.getInitParameter(“encoding“);
???
?}
??
??public?void?doFilter(ServletRequest?request?ServletResponse?response?FilterChain?chain)?throws?IOException?
ServletException?{
????
????if?(encoding?!=?null)?{
??
??????????request.setCharacterEncoding(encoding);
??
??????????response.setContentType(“text/html;?charset=“+encoding);
????
????}
????????
chain.doFilter(request?response);
??
??}
???
?public?void?destroy()?{
?
???????this.encoding?=?null;
??
??????this.filterConfig?=?null;
???
?}
}
- 上一篇:ieee30節點pscad
- 下一篇:23steam授權
評論
共有 條評論