[jboss-user] [JBoss Seam] - Re: Bug? Outjected boolean changes value mid-template

tomstrummer do-not-reply at jboss.com
Sun Feb 17 18:46:05 EST 2008

I expect Seam to re-initialize the value when it goes out of scope.  

How does Seam know when a context variable goes out of scope?  If Seam sees a @Out variable go out of scope, then it sees the bijected field with no factory...  It should just ignore it and leave whatever value happened to be there?  Once the value goes out of scope, I hoped it would be re-initialized to false.  Ok, so I wouldn't be surprised if you couldn't keep track of the initial value, but at least set it to null.  

Using a Boolean doesn't help.  And the problem is I only set the value to true when I need to (show the form).  The rest of the time, i.e. after it goes out of scope, I need it to be false.  But like I said, that means I need a factory just to re-initialize a page-scoped boolean.  Otherwise it hangs on to the old value.  

Can you elaborate on your suggestion?  My situation feels analogous to having a variable defined in a method, and the variable is getting the value it had when method was last called.  (Obviously the mechanics are very different but from a user standpoint I am in the same situation.)

I solved my problem making all of my beans that keep track of the form state stateful & page scoped.  

Like I said, think I understand why this is happening, I just don't think it's a very desirable behavior.  It sounds like the answer is "don't biject a narrow-scoped field into a wide-scoped bean unless you have a factory.  If you do, you'll have an inconsistent state when the template is rendered."  But regardless of why it is happening, I don't think it is um, "good" behavior or desirable in any situation and suggest it be disallowed or at least document some sort of warning or output a log warning when such a thing is detected....  Is that at least possible?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129994#4129994

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129994

More information about the jboss-user mailing list