org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435).
At point of nothing to response to client (browser)
Following is sample example
if(a.equals("7")){
RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
}
if(b.equals("6")){
RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
}
In first block itself it respond to browser . In step 2 nothing to response
so this exception will occur
To Avoid Exception java.lang.IllegalStateException.
Add return statement .
if(a.equals("7")){
RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
return;
}
java.lang.IllegalStateException
At point of nothing to response to client (browser)
Following is sample example
if(a.equals("7")){
RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
}
if(b.equals("6")){
RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
}
In first block itself it respond to browser . In step 2 nothing to response
so this exception will occur
To Avoid Exception java.lang.IllegalStateException.
Add return statement .
if(a.equals("7")){
RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
return;
}
No comments:
Post a Comment