1.getRequestDispatcher中文乱码:
解决方法:在Servlet的get或post方法中使用response.setCharacterEncoding("UTF-8");
2.错误:java.sql.SQLException: Before start of result set
解决: 在select 结果集rs = stmt.executeQuery(sql);后要加上if(rs.next())
原因:在对结果集ResultSet进行操作之前,一定要先用ResultSet.next()将指针移动至结果集的第一行
看看API对next()方法的描述: