First of all, the subject is misleading, right? As you said yourself, JRun's
JSPs catch _all_ exceptions in its service method.
As for the single try/catch block, you may think this is lame, but this is
according to the JSP specification. Can you think of a better way to catch all
uncaught exceptions in the body of a JSP? The container has to catch any
potential uncaught exceptions and handle them in a standard way.
Looking at the source of some JSPs translated under Tomcat 3.1 and Resin 1.1.3,
this is exactly what they do. The only difference being that JRun catches
Throwable while Tomcat and Resin catch Exception.
JRun 2.3.3, on the other hand, does not do this. Is this within the 1.0 spec? I
don't know. Does Weblogic do this? Which version?
JSPs aren't intended to have a lot of Java code in them. Yes, you can put
whatever you want in them, but that's not how they are designed to be used. If
you want your own try/catch blocks, you can and should put them in declarations,
or following the Model 2 architecture, use JavaBeans and/or custom tags.
Scott Stirling
-----Original Message-----
From: ana226888 [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 21, 2000 3:42 PM
To: JRun discussion (E-mail)
Subject: JSP fails to catch exceptions
Hey everyone,
I noticed some very strange behavior in the way JRun treats blocks of code
that are supposed to throw exceptions. For instance, if i have the code:
SomeClass c = SomeOtherClass.getInstance("blah");
which is supposed to throw an exception "SomeException", JRun never
complains that that code is not in a try/catch block.
I did some investigating and looks like the generated servlet wraps *all*
code in a try/catch block for you. I think this is kind of lame for a couple
of reasons:
1) I want to know when the classes I write throw exceptions so i can deal
with them as I had planned (that's why my classes throw exceptions in the
first place! :) ).
2) This makes my JSP pages entire un-portable. Now i know why i get a
million compile time errors when I port to JRun 2.3.x or WebLogic, etc.
Is there an option to disable this "feature"? I love JRun 3 so far but this
small issue is making me want to switch to Tomcat or Resin.
Thanks!
--Bill
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.