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

try {
    username = session.getAttribute("username").toString();
   } catch(NullPointerException ex) {
    request.getRequestDispatcher("LoginServlet").forward(request, response);
    
    return; // 务必注意要加上 return
   }

 

你可能感兴趣的:(java)