>From: Konstantin Kolinko <knst.koli...@gmail.com>
>To: Tomcat Users List <users@tomcat.apache.org>
>Sent: Saturday, August 27, 2011 12:40 PM
>Subject: Re: Exception Handling
>
>2011/8/27 Donald Jolley <jolleyt...@gmail.com>:
>> For days I have been playing around with trying to develop a general-purpose
>> forwarding mechanism that I could use to forward to an errors page upon the
>> occurrence of an exception.  It has just been revealed to me that this
>> approach is not going to work because once a response is committed it is no
>> longer possible to forward.  That being the case, I'd love to hear
>> suggestions as to what should be done upon the occurrence of an exception.
>> At a minimum, I'd like to get some basic information about the exception
>> displayed.  I realize that I could just stuff that information into the
>> response buffer.  It seems to me that that approach has the potential for
>> being a bit crude depending upon the state of the response buffer at the
>> time the exception occurred (it could be right in the middle of a table, for
>> example).  Suggestions?
>
>1. Exception handling can be configured in WEB-INF/web.xml (see spec)
>
>2. I suggest you to look at MVC web frameworks. In short, you have a
>servlet that calls your class that does all the work. After processing
>you forward to a JSP page and the page is then used only to display
>the result (and thus having errors there will be less probable).
>
>My favorite one is part of the Spring framework. [1][2] There are
>others as well (e.g. Struts).
>
>[1] http://www.springsource.org/download
>[2] 
>http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html
>
>Best regards,
>Konstantin Kolinko


Donald,

You've been exploring a lot of fundamental ideas about servlets / jsp / java 
web applications.

I'd like to suggest a different book if I could:

Head First Servlets and JSP by Batham, Sierra, Bates

I have the first edition, but the second edition is out.

The book talks about (among other things) error handling (pgs 457-464), 
forwarding (pgs 204-205 including IllegalStateException), and weaves MVC 
throughout the book. It's a pretty fun read, with lots of questions, answers, 
and problems to work on.

I think you should build a few small web applications by hand (using the MVC 
design pattern of course) before plunging into frameworks. Once you are 
comfortable with how that works, then investigate frameworks.

Doing it this way will help you understand what the frameworks are doing under 
the covers, as well as give you an appreciation for the amount of effort that 
frameworks can save.

Like Konstantin, I like the Spring framework. Struts 2 is interesting, but 
seems to marry code and output formatting too tightly for my tastes. JSF 2 is 
nice, but the standard output is XHTML, which Internet Explorer doesn't handle 
properly.

. . . . just my two cents.
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to