RE: ModelLifetime.discard() issue

"Schnitzer, Jeff" <[email protected]>
Newsgroups gmane.comp.web.maverick.general
Message-ID <[email protected]>
> From: Trebor Carpenter [mailto:[email protected]]
> 
> Hi,

Hi!

> I'm using maverick 2.2.0 and running into a small inconsistency in
> behavior. My controllers generally derive from FormBeanUser, and my
> formBeans all implement ModelLifetime. The problem I'm seeing is that
if
> I do a forward (using a null view type) from one controller to
another,
> the second controller's formBean gets discard() called twice and the
> first controller's formBean does not get discard() called at all.
> 
> I'm not sure what additional details would be useful to troubleshoot
> this.

Do you have the "reuseMaverickContext" flag turned on?  I can see how
this would cause trouble with null views.

The basic logic (in CommandBase) is:

try
{
    execute the controller
    get the model from the context and store in local variable
    execute the view
}
finally
{
    call model.discard()
}

This works fine as long as the forward (and maverick context recycling)
occurs during view processing because we've already gotten a hold of the
model before the recursion.  However, when the forward occurs in the
controller (as with a null view), we're doomed - the model gets replaced
in the context before we can get a reference.

I'm not sure there is a good solution to this problem.  Why do you need
"reuseMaverickContext" to be turned on?  I've never really liked this
flag.

> Incidentally, this is my third project using Maverick. I have a very
> small framework of classes that tie together Maverick, Formproc,
TopLink
> and I use Velocity for the view layer. Initially I had a very
difficult
> time persuading my colleagues that this was the way to go for us
("we've
> never heard of it. jsp is standard! struts is standard!") But since
then
> two of them have also used it and are now full converts raving to me
how
> much they love Maverick and love Velocity. Obviously not the right
> combination for all problems but near perfect in our case. Thanks for
a
> great framework!

Thanks, we love hearing this stuff :)

Jeff Schnitzer
[email protected]


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
[INVALID FOOTER]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.