We have it implemented a little differently
public final class myAction report extends Action
{
public ActionForward perform(...)
{
try {
dbh = get_database_connection()
initialize_some_beans( dbh , other , stuff );
} catch {
return (mapping.findForward("error"));
}
finally
{
close_connection_no_matter_what();
}
return (mapping.findForward("success"));
}
}
Dean Chen
-----Original Message-----
From: Nelson, Laird [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 3:15 PM
To: 'Struts Users Mailing List'
Subject: RE: how do I do something after a forward?
> -----Original Message-----
> From: Malcolm Dew-Jones [mailto:[EMAIL PROTECTED]]
> Want I want is conceptually the same as
>
> public final class myAction report extends Action
> {
> public ActionForward perform(...)
> {
> dbh = get_database_connection()
> initialize_some_beans( dbh , other , stuff );
>
> try
> {
> return (mapping.findForward("success"));
> }
> finally
> {
> close_connection_no_matter_what();
> }
> }
> }
>
> Obviously the above does not work.
It should; finally blocks are supposed to execute before the final value is
returned.
See
http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#2
36653 for details.
Cheers,
Laird
--
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]>