import java.io.*; import javax.servlet.*; public class HelloWorldEncodingFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { // エンコーディング指定 req.setCharacterEncoding("Shift_JIS"); // 元々要求されていたリソースを呼び出します chain.doFilter(req, res); } public void init(FilterConfig config) throws ServletException { } public void destroy() { } }