---servlet 檔案
package com。encoding;
import java。io。IOException;
import javax。servlet。FilterChain;
import javax。servlet。
FilterConfig;
import javax。servlet。ServletException;
import javax。servlet。ServletRequest;
import javax。servlet。ServletResponse;
public class Encoding
implements javax。
servlet。Filter {
public void destroy() {
/ / TODO Auto-generated method stub
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request 。
setCharacterEncoding("GBK");
chain。doFilter(request, response);
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
---XML配置檔案
encoding
com。
encoding;。Encoding
/*。
---servlet 檔案
package com。encoding;
import java。io。IOException;
import javax。servlet。FilterChain;
import javax。servlet。
FilterConfig;
import javax。servlet。ServletException;
import javax。servlet。ServletRequest;
import javax。servlet。ServletResponse;
public class Encoding
implements javax。
servlet。Filter {
public void destroy() {
/ / TODO Auto-generated method stub
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request 。
setCharacterEncoding("GBK");
chain。doFilter(request, response);
}
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
}
---XML配置檔案
encoding
com。
encoding;。Encoding
encoding
/*。