Re: Catching Thrown Exceptions
Ok, I apologize for not including specific details.
This is a jsp file and I had the following inside
a try block...
if ( condition )
You shouldn't have Java source in a JSP page.
Perhaps you are aware that 'exception' is a predefined
variable in an error JSP that has value only when there
actually is an exception? Or perhaps you mean something
different by "compiled" than I do? You send us these
code fragments that yield no context. On the face of it
I don't know how your code fragment was able to compile
From what I have read it is perfectly acceptable to have code in a JSP
page. It has been said that if there is more HTML than code a JSP is
the proper thing to use. If there is more code than HTML then a
servlet is the proper thing to use. Do you disagree with this?
Absolutely I disagree. It's wrong.
JSPs are a view artifact. Period. No code.
Java-source servlets should be used for controller functionality and certain
front-facing logic only, i.e., view or controller artifact (but not both at
once). Either they display stuff and do no logic, or they do logic and no
display (to a first order of approximation).
POJOs are for business and back-end logic. No display, no controller - all logic.
Google "Model 2" architecture.
Yes, I had a syntax error. No I did not know that exception was a
system variable. No I don't care about documenting the error in this
tiny example program. And no I am not yet comfortable with JIT
compiles. I don't know how to force Netbeans to do a complete
What do "JIT" compiles have to do with anything? I don't understand the point
you're trying to make here.
NetBeans doesn't compile JSPs. The application server compiles the JSPs. You
can convince NetBeans to "Test compile all JSP files during builds" in the
project properties dialog. The answer to "I don't know how to force NetBeans
to..." is to *find out how to force NetBeans to ..."! You don't just say, "I
don't know" in programming, you find out! Anything else is laziness.
Please do go and study the recommended links and tutorials. You are never
going to make good progress if you ignore the documentation like this.
Honi soit qui mal y pense.