/* ====================================================================
* The Tmax soft License, Version 1.1
*
* Copyright (c) 1997-2004 The Tmax software.
* All rights reserved.
* html code omitted for readability.
/* ====================================================================
/*
## error.html
*/
This sample uses errorpage directive
Select a fruit that I think.
If you want to show the error page, don't select the middle one.
/*
## err.jsp
*/
<%@ page errorPage="errorpge.jsp" %>
<%
String name = null;
String query = null;
query = request.getParameter("name");
if (query.equalsIgnoreCase("orange"))
name = query;
// if you don't select a orange, name is null object
// so name.equalsIgnoreCase("orange") will make a Null Pointer Exception
// and request will be forwarded to the Error page specified in the page directive
if (name.equalsIgnoreCase("orange"))
{
%>
Yes. I think a orange.
<%
}
%>
/*
## errorpage.jsp
*/
<%@ page isErrorPage="true" %>
The exception <%= exception.getMessage() %> tells me you
made a wrong choice.