RE: ModelLifetime.discard() issue
"Trebor Carpenter" <[email protected]>
| Newsgroups | gmane.comp.web.maverick.general |
|---|---|
| Message-ID | <1DB2064DB5E51046A3C899A1E0DC31010A6A7D@serveboy.prod.netspend.net> |
Turning off reuseMaverickContext does indeed take care of this. I had forgotten I had that turned on. I originally turned it on simply because that was the behavior before 2.2.0 made it optional, and I wasn't sure whether I needed it or not. Thanks! -- Trebor Carpenter, mailto:[email protected] -----Original Message----- From: Schnitzer, Jeff [mailto:[email protected]] Sent: Thursday, August 14, 2003 7:28 PM To: [email protected] Subject: RE: [Mav-user] ModelLifetime.discard() issue > 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] ------------------------------------------------------- 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]