All sorts of options... Simply using the null outcome is the easiest fix, but I agree that it should be defining disabledness in the xhtml and using a method as you describe that would contain that logic, or include the login in the xhtml if it's simple.
Thanks! -----Original Message----- From: noah [mailto:[EMAIL PROTECTED] Sent: Friday, March 23, 2007 3:48 PM To: [email protected] Subject: Re: Components reinjected losing disabled state On 3/23/07, Daniel Hannum <[EMAIL PROTECTED]> wrote: > It's not request scoped, so I could do > > public MyComponent getMyComponent() { > myComponent.setDisabled(radioButtonValue == 1); > return myComponent; > } > > But that's ugly > > Best way to keep it from reseting is do it in the markup > > <yourComponent disabled="#{radioButtonValue == 1}"/> > > But that's putting a magic number in the UI. Not good. > > actionListeners were recommended because they don't reset the component > tree, but I don't like it because I really do need to do business logic, > it just happens to bring you back to the same page. Actions seem like > the right thing, but they reset the tree, and there's no good place to > put the components back the way they're supposed to be. > > Still seems to be no good solution. Is there something I'm not seeing? What would be wrong with: <yourComponent disabled="#{yourBean.isXDisabled}"/> and yourBean having: public boolean isXDisabled() { return radioButtonValue == 1; } That way the disabledness of the component isn't coupled directly to the radioButton.
