If you have a try/catch block in a jsp and you catch an error that is know to cause
the page not
to function, how can you gracefully skip the rest of the jsp page and print an error
message. For
example, in the below code pictureBrowserBean.parseAlbums(); is going to throw a null
pointer
exception. I want the catch block to print an error message and quit running the jsp.
How do I
do this?
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="pictureBrowserBean" scope="session"
class="mada.trips.PictureBrowserBean" />
<%
//pictureBrowserBean.setBaseDir(getServletConfig().getServletContext().getRealPath("/"));
pictureBrowserBean.setBaseDir("");
pictureBrowserBean.setAlbumDir("images/");
try {
pictureBrowserBean.parseAlbums();
}
catch (NullPointerException e) {
out.println(e.toString());
}
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>