Posted By:
Anonymous
Posted On:
Tuesday, August 13, 2002 08:18 AM
Hi all. I´m tring something like this. I have a a.jsp which has: The method register checks so there isn´t to many users allready. If there are to many users I want to redirect user to another page, b.jsp. So far I tried: 1: RequestDispatcher rd; rd = getServletContext().getRequestDispatcher( "b.jsp" ); rd.forward( req, res ); Error: java.lang.IllegalStateException: Cannot forward after response has been committed 2: res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); res.setHeader("Location", "b.jsp" ); Error: Browser shows a.jsp
More>>
Hi all.
I´m tring something like this.
I have a a.jsp which has:
The method
register
checks so there isn´t to many users allready. If there are to many users
I want to redirect user to another page, b.jsp. So far I tried:
1:
RequestDispatcher rd;
rd = getServletContext().getRequestDispatcher( "b.jsp" );
rd.forward( req, res );
Error: java.lang.IllegalStateException: Cannot forward after response has been committed
2:
res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
res.setHeader("Location", "b.jsp" );
Error: Browser shows a.jsp
3:
res.sendRedirect( res.encodeRedirectURL( "b.jsp" ) );
return;
Error: Browser shows a.jsp
Nothing seems to work for me. Any suggestion how to solve this? Help is appreciated.
Regards Tobias