java.lang.IllegalStateException: Cannot forward after response has been committed

if ("blog".equals(flag1)){
   req.getRequestDispatcher("/jsp/blogmanager.jsp").forward(req, resp);
}
   req.getRequestDispatcher("/jsp/myblog.jsp").forward(req, resp);

 
  
这样写两个都会执行,后改成
 
  
if ("blog".equals(flag1)){
   req.getRequestDispatcher("/jsp/blogmanager.jsp").forward(req, resp);
}else {
   req.getRequestDispatcher("/jsp/myblog.jsp").forward(req, resp);
}
就OK了

你可能感兴趣的:(java.lang.IllegalStateException: Cannot forward after response has been committed)