On Mon, Sep 05, 2005 at 06:28:05PM +0100, Paul Singleton wrote:
: But we want *no* error page, just a 404 status returned to
: the browser, which will then presumably present this failure
: to the user in its own way.  Or have I musunderstood 404s?

Yes and no.  Browsers are free to interpret 404s (and any other error
code) as they see fit.  For example, IE's "friendly error messages" will
interpret the status code and show the user its own "not found" page
instead of the data returned by the server.


: Exactly what <error-page> element will achieve this, and
: where should we call ...setStatus(...NOT_FOUND)?

If you *really* want to leave this up to the browser, map the
<error-page> to a JSP that simply sets a 404 response and returns no
data.  (I forget the exact API call for this, but it's in the
HttpServlet or HttpServletRequest JavaDoc.)

Another alternative would be to have the <error-page> redirect people to
the site's landing page.  (The idea is, "if you've hit an invalid URL,
go back to the beginning.")  I've done this before for certain sites.

The real question is, do you really want to do this?

Unless you're writing a highly specialized app, it's not nice to fool
the end-user on error conditions.  The JSP that just sends a 404 may
yield "document contains no data" errors from the browser; and
redirecting people to the landing page may hide broken links (read:
developer error) and/or frustrate the user.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to