No I have tried this:
Code:
public class DispatcherServletHandler extends DispatcherServlet {
/**
if a url (servlet name) is entered in Browser which does not exist, than redirect to an error page
*/
@Override
protected void noHandlerFound(HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println("Class DispatcherServletHandler, method noHandlerFound: " + request.getRequestURL() + ", User will be redirected to default page index.htm");
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("./index.htm");
dispatcher.forward(request,response);
}
}
It works but I only can redirect to the index.htm page (this is the default page) but I can't redirect to an error page.
Does anyone know what I am doing wrong?
Thanks a lot!
Generic