在使用request.setCharacterEncoding("gb2312")之前,不能用request获取参数。
request.setCharacterEncoding("gb2312")此行代码必须写在最前面或者所有request.getParameter("");方法之前,如果在此前进行任何request.getPragrmber()方法都会使字符转换失效!必须要在读取request的getParameter()和 getReader() 方法之前调用 否则字符转换失效
void setCharacterEncoding(String env) throws UnsupportedEncodingException
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader(). Otherwise, it has no effect.