tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Pfeiffer <adamcpfeif...@yahoo.com>
Subject How to end a JSP
Date Wed, 15 May 2002 18:11:11 GMT
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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message