Re: How to end a JSP

2002-05-15 Thread Nikola Milutinovic


- Original Message - 
From: "Adam Pfeiffer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 8:11 PM
Subject: How to end a JSP


> 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?

:-)

Throw an exception.

The only way to abort and already written ServletResponse object is to cause the page 
not to finish it's service() method and even that can fail if buffer was already 
(partially) commited. But, anyway, throwing an exception is the way. You can configure 
Tomcat to use custom ErrorPages for a specific JSP page or an exception class.

Nix.



RE: How to end a JSP

2002-05-15 Thread Adam Pfeiffer

Thanks for all the input. return; worked perfect.  

Thanks.

--- James Mitchell <[EMAIL PROTECTED]> wrote:
> 
> that was a joke
> 
> 
> JM
> 
> > -Original Message-
> > From: James Mitchell [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 15, 2002 4:37 PM
> > To: Tomcat Users List
> > Subject: RE: How to end a JSP
> >
> >
> > Try this.
> >
> >
> > System.exit(0);
> >
> > That works for me ;)
> >
> > JM
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, May 15, 2002 4:34 PM
> > > To: Tomcat Users List
> > > Subject: Re: How to end a JSP
> > >
> > >
> > >
> > > Since nobody else answered, not sure but I would think a simple
> > "return;"
> > > as placed would do what you want.
> > > troy
> > >
> > >
> > >
> > >
> > >
> > >   Adam Pfeiffer
> > >
> > >> > [EMAIL PROTECTED]
> > >   ahoo.com>cc:
> > >
> > >Subject: How to
> > > end a JSP
> >
> > >   05/15/2002 01:11
> > >
> > >   PM
> > >
> > >   Please respond
> > >
> > >   to "Tomcat Users
> > >
> > >   List"
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > <%@page contentType="text/html"%>
> > > 
> > > JSP Page
> > > 
> > >
> > > <%@ page import="java.io.*" %>
> > > <%@ page import="java.util.*" %>
> > >
> > >  > > ="mada.trips.PictureBrowserBean" />
> > >
> > > <%
> > > //pictureBrowserBean.setBaseDir(getServletConfig().getServletContext
> > > ().getRealPath("/"));
> > > pictureBrowserBean.setBaseDir("");
> > > pictureBrowserBean.setAlbumDir("images/");
> > > try {
> > >pictureBrowserBean.parseAlbums();
> > > }
> > > catch (NullPointerException e) {
> > >out.println(e.toString());
> > >return; // HERE
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


__
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]>




RE: How to end a JSP

2002-05-15 Thread Richard Bailey

I saw it once mentioned you could use out.close ();


At 04:36 PM 2002-05-15 -0400, James Mitchell wrote:
>Try this.
>
>
>System.exit(0);
>
>That works for me ;)
>
>JM
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 15, 2002 4:34 PM
> > To: Tomcat Users List
> > Subject: Re: How to end a JSP
> >
> >
> >
> > Since nobody else answered, not sure but I would think a simple "return;"
> > as placed would do what you want.
> > troy
> >
> >
> >
> >
> >
> >   Adam Pfeiffer
> >
> >> [EMAIL PROTECTED]
> >   ahoo.com>cc:
> >
> >Subject: How to
> > end a JSP
>
> >   05/15/2002 01:11
> >
> >   PM
> >
> >   Please respond
> >
> >   to "Tomcat Users
> >
> >   List"
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > <%@page contentType="text/html"%>
> > 
> > JSP Page
> > 
> >
> > <%@ page import="java.io.*" %>
> > <%@ page import="java.util.*" %>
> >
> >  > ="mada.trips.PictureBrowserBean" />
> >
> > <%
> > //pictureBrowserBean.setBaseDir(getServletConfig().getServletContext
> > ().getRealPath("/"));
> > pictureBrowserBean.setBaseDir("");
> > pictureBrowserBean.setAlbumDir("images/");
> > try {
> >pictureBrowserBean.parseAlbums();
> > }
> > catch (NullPointerException e) {
> >out.println(e.toString());
> >return; // HERE
> > }
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


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




RE: How to end a JSP

2002-05-15 Thread James Mitchell


that was a joke


JM

> -Original Message-
> From: James Mitchell [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 15, 2002 4:37 PM
> To: Tomcat Users List
> Subject: RE: How to end a JSP
>
>
> Try this.
>
>
> System.exit(0);
>
> That works for me ;)
>
> JM
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 15, 2002 4:34 PM
> > To: Tomcat Users List
> > Subject: Re: How to end a JSP
> >
> >
> >
> > Since nobody else answered, not sure but I would think a simple
> "return;"
> > as placed would do what you want.
> > troy
> >
> >
> >
> >
> >
> >   Adam Pfeiffer
> >
> >> [EMAIL PROTECTED]
> >   ahoo.com>cc:
> >
> >Subject: How to
> > end a JSP
>
> >   05/15/2002 01:11
> >
> >   PM
> >
> >   Please respond
> >
> >   to "Tomcat Users
> >
> >   List"
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > <%@page contentType="text/html"%>
> > 
> > JSP Page
> > 
> >
> > <%@ page import="java.io.*" %>
> > <%@ page import="java.util.*" %>
> >
> >  > ="mada.trips.PictureBrowserBean" />
> >
> > <%
> > //pictureBrowserBean.setBaseDir(getServletConfig().getServletContext
> > ().getRealPath("/"));
> > pictureBrowserBean.setBaseDir("");
> > pictureBrowserBean.setAlbumDir("images/");
> > try {
> >pictureBrowserBean.parseAlbums();
> > }
> > catch (NullPointerException e) {
> >out.println(e.toString());
> >return; // HERE
> > }
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



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




RE: How to end a JSP

2002-05-15 Thread James Mitchell

Try this.


System.exit(0);

That works for me ;)

JM 

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 15, 2002 4:34 PM
> To: Tomcat Users List
> Subject: Re: How to end a JSP
> 
> 
> 
> Since nobody else answered, not sure but I would think a simple "return;"
> as placed would do what you want.
> troy
> 
> 
> 
>   
>   
>   Adam Pfeiffer   
>   
>[EMAIL PROTECTED]  
>   ahoo.com>cc:
>   
>Subject: How to 
> end a JSP

>   05/15/2002 01:11
>   
>   PM  
>   
>   Please respond  
>   
>   to "Tomcat Users
>   
>   List"   
>   
>   
>   
>   
>   
> 
> 
> 
> 
> <%@page contentType="text/html"%>
> 
> JSP Page
> 
> 
> <%@ page import="java.io.*" %>
> <%@ page import="java.util.*" %>
> 
>  ="mada.trips.PictureBrowserBean" />
> 
> <%
> //pictureBrowserBean.setBaseDir(getServletConfig().getServletContext
> ().getRealPath("/"));
> pictureBrowserBean.setBaseDir("");
> pictureBrowserBean.setAlbumDir("images/");
> try {
>pictureBrowserBean.parseAlbums();
> }
> catch (NullPointerException e) {
>out.println(e.toString());
>return; // HERE
> }
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

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




Re: How to end a JSP

2002-05-15 Thread TMotte


Since nobody else answered, not sure but I would think a simple "return;"
as placed would do what you want.
troy



   
 
  Adam Pfeiffer
 
  cc: 
 
   Subject: How to end a JSP   
 
  05/15/2002 01:11 
 
  PM   
 
  Please respond   
 
  to "Tomcat Users 
 
  List"
 
   
 
   
 




<%@page contentType="text/html"%>

JSP Page


<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>



<%
//pictureBrowserBean.setBaseDir(getServletConfig().getServletContext
().getRealPath("/"));
pictureBrowserBean.setBaseDir("");
pictureBrowserBean.setAlbumDir("images/");
try {
   pictureBrowserBean.parseAlbums();
}
catch (NullPointerException e) {
   out.println(e.toString());
   return; // HERE
}







--
To unsubscribe, e-mail:   
For additional commands, e-mail: