一、maven中classnotfound
1.其实是jar包问题,maven默认会把jar包编译到target下面,而tomcat需要在WEB-INF目录下使用它,所以发现没有的问题
需要在pom.xml中配置

maven-compiler-plugin

1.6

1.6

UTF-8



  src\main\webapp\WEB-INF\lib

二、解决springmvc的get乱码问题
1.post处理乱码是这样的

encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
true

encoding
UTF-8



encodingFilter
/*

    2.get乱码处理
    public class EncodingFilter extends OncePerRequestFilter {  
private String encoding;  

public void setEncoding(String encoding) {  
    this.encoding = encoding;  
}  

@Override  
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)  
        throws ServletException, IOException {  
    // 设置请求响应字符编码  
    request.setCharacterEncoding(encoding);  
    response.setCharacterEncoding(encoding);  

    // 传递给目标servlet或jsp的实际上是动态代理的对象,而不是原始的HttpServletRequest对象  
    request = (HttpServletRequest) Proxy.newProxyInstance(request.getClass().getClassLoader(), request.getClass().getInterfaces(), new MyInvacationHandler(request));  
    chain.doFilter(request, response);  
}  

class MyInvacationHandler implements InvocationHandler{  
    private HttpServletRequest request;  
    MyInvacationHandler(HttpServletRequest request){  
        this.request=request;  
    }  

    @Override  
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {  
        switch (method.getName()) {  
        case "getParameter":  
            String value = request.getParameter((String)args[0]);  
            try {  
                if(value != null){  
                    value=new String(value.getBytes("ISO-8859-1"),encoding);  
                }  
            } catch (UnsupportedEncodingException e) {  
                e.printStackTrace();  
            }  
            return value;  
        case "getParameterValues":  
            String[] values = request.getParameterValues((String)args[0]);  
            if (values != null) {  
                for (int i = 0; i < values.length; i++) {  
                    try {  
                        values[i] = new String(values[i].getBytes("ISO-8859-1"),encoding);  
                    } catch (UnsupportedEncodingException e) {  
                        e.printStackTrace();  
                    }  
                }  
            }  
            return values;  
        default:  
            return method.invoke(request, args);  
        }  
    }  

}  

}

web.xml配置

encodingFilter12
com.wjw.controller.EncodingFilter

encoding
utf-8



encodingFilter12
/*

或者server.xml中配置
connectionTimeout="20000"
redirectPort="8443" URIEncoding="utf-8"/>