Results 1 to 3 of 3

Thread: error 404 page

  1. #1
    Join Date
    Apr 2006
    Posts
    166

    Default error 404 page

    Hi

    In my controller (that implements Controller class), I want to go to default error 404 "File not found" like:

    ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) {
    ...
    if
    return new ModelAndView ("myPage", myModel);
    else
    goto error page 404.
    }

    How I can do this
    many thanks
    Last edited by shoa; Sep 6th, 2008 at 04:02 PM.

  2. #2
    Join Date
    Sep 2008
    Location
    Szczecin, Poland
    Posts
    2

    Default

    You can do something like that:
    Code:
    if (...) {
       return new ModelAndView ("myPage", myModel);
    } else {
       response.sendError(HttpServletResponse.SC_NOT_FOUND);
       return null;
    }

  3. #3
    Join Date
    Apr 2006
    Posts
    166

    Default thanks

    thanks! ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •