incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvanma...@comcast.net (Gary VanMatre)
Subject Re: Components reinjected losing disabled state
Date Fri, 23 Mar 2007 15:55:31 GMT
>From: "Daniel Hannum" <dhannum@quovadx.com> 
>
> This may be a basic JSF question... I'm not sure. 
> 
> 
> 
> I have a component on a page that is bound to a backing bean member. 
> During page logic, I use setDisabled(true) to disable the component 
> under some conditions. Now, after the form is submitted, JSF seems to 
> reinject new component objects into my backing bean. So, the next time 
> the page is displayed, loses the disabled state. I didn't know it would 
> do this. I guess I thought I would get to keep my component instances 
> and not have new ones given to me on each request. 
> 
> 
> 
> As far as a solution goes, I guess I could put logic in the getter 
> (getMyComponent()) for figuring out if we should be disabled or not. 
> That way it would always be done, but it seems inefficient to do it 
> every time. 
> 
> 
> 
> Does that seem like the best solution? I know putting the logic in the 
> markup itself would also work, though I think I need to do more than EL 
> can do (I need to check if a radio button has a particular value). 
> 
> 
> 
> Thoughts? 
>


You might check to make sure that your backing bean is in session or pageFlowScope scope.

Something else to look at is the use of "action" versus "actionListener" binding to command
components.

If you use an "action" binding returning an "outcome" that matches a navigation rule in the
faces-config.xml, the component tree will be recreated with all new component instances. 
 If you use the "actionListener" binding, the component tree will be preserved.

 
> 
> 
> Thanks. 
> 
> 


Gary
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message