Announcement Announcement Module
Collapse
No announcement yet.
error 404 page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 04:02 PM.

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

    Comment


    • #3
      thanks

      thanks! ...

      Comment

      Working...
      X