1.Error setting driver on UnpooledDataSource
具体:Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.jdbc.Driver
原因:该问题出现的原因是jdbc.properties文件里driver后面有空格,所以注意properties里的空格
2.Cannot forward after response has been committed
具体:我现在遇到的该问题是出现在Filter的使用时出现的。
原因:在过滤servlet请求时,在servlet中己经调用getRequestDispatcher,在flter再调用一次getRequestDispatcher或在Filter中调用完getRequestDispatcher后再调用chain.doFilter();
if(!isExcludeQuery(queryStr))
{
String filterflag = request.getParameter("filterflag"); if(user == null)
{
request.setAttribute("filter_mess","不好意思,你还没有登录");
if("front".equals(filterflag))
//前台请求标志
request.getRequestDispatcher("../index.jsp").forward(request, response);
else
request.getRequestDispatcher("../manager/login.jsp").forward(request, response);
//return;
}
}
chain.doFilter(request, response);
注意:
1.14行注释掉的retunr,return为必须的
2.不管是servlet还Filter,request.getRequestDispatcher并不等于return,也就是并不是结束程序调用,返回系统,chain和servlet都是链的模型,可以多次使用