You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by s l <si...@yahoo.com> on 2001/03/21 23:23:38 UTC

exception handling

Is there a way to catch exceptions throw
in bean's getter methods (so we don't have
to see the stack trace on web page)?

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: exception handling

Posted by Incze Lajos <in...@mail.matav.hu>.
On Wed, Mar 21, 2001 at 02:23:38PM -0800, s l wrote:
> Is there a way to catch exceptions throw
> in bean's getter methods (so we don't have
> to see the stack trace on web page)?
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/

You are free to catch exceptions in your beans' getter and
setter methods. But (if I understand the direction of the
question) the "best practice considering the from beans is
to keep your form bean properties as strings. This way you
avoid exceptions during automatic request parameter population
and your form bean is ready to report back the errorprone
inputfields as they were entered. Validate methods will
investigate that these strings are OK to be converted to
your business model, and your action will actually do
the transformation and check the parameters against business
rules. Maybe I misunderstood your problem.            incze

Re: exception handling

Posted by Scott Walter <tx...@yahoo.com>.
You could use the JSP error handling mechanism to
display a friendly message instead of the stacktrace. 
Within the error handling page you could log the
exception to the file system or a database.

Look into the page directive tag, in particular the
isErrorPage and errorPage attributes.

scott.
--- s l <si...@yahoo.com> wrote:
> Is there a way to catch exceptions throw
> in bean's getter methods (so we don't have
> to see the stack trace on web page)?
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scott

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/