1 Reply Latest reply on May 7, 2014 7:28 AM by gimbal2

    keeping the UI component's state on the server side

    user13162080

      I am a newbie in JSF and I have been reading about saving the view state of components in JSF. I dont know if I have got it. Some questions:

      1) The component view state refers to the validators, converters and some other stuff attached to the form fields and the reason they are saved is because you can change them programmatically; for example with the next code: ...."getComponent().setRendered(false)" I could change the visibility of a component and this would be saved in the state of the component, right?

      2) These components view states are saved in session , right? Because I could want to hide some component for a user and make the same component visible to another user, right?

      3)The values of input forms, are saved in the state of UIComponents? I mean in the components itself and not in backed beans. If yes, why?

      4) Are there other stuff besides converters, validators of a form that is saved in the state of the component?

      5) Is possible to change validators, converters, add/delete form fields, modify a cssClass of a component,etc... programmatically?

       

      Thanks

        • 1. Re: keeping the UI component's state on the server side
          gimbal2

          user13162080 wrote:

           

          I am a newbie in JSF and I have been reading about saving the view state of components in JSF. I dont know if I have got it. Some questions:

          1) The component view state refers to the validators, converters and some other stuff attached to the form fields and the reason they are saved is because you can change them programmatically; for example with the next code: ...."getComponent().setRendered(false)" I could change the visibility of a component and this would be saved in the state of the component, right?

          2) These components view states are saved in session , right? Because I could want to hide some component for a user and make the same component visible to another user, right?

          3)The values of input forms, are saved in the state of UIComponents? I mean in the components itself and not in backed beans. If yes, why?

          4) Are there other stuff besides converters, validators of a form that is saved in the state of the component?

          5) Is possible to change validators, converters, add/delete form fields, modify a cssClass of a component,etc... programmatically?

           

          Thanks

          1) Basically yes, but your questions indicate you don't really understand what "state" is

          2) Yes, they are bound to a specific client (of course)

          3) Yes. You'd have to ask the JSF designers for the specific reasonings, but one thing is that you should be able to change the state of the component without that reflecting in the backing bean immediately. Ex: when there are validation errors

          4) Yes - the actual state of the component. Converters and validators are not state (well... not really). The value of a text field is a state. Which selectable values there are in a selection box is a state. If a field is readOnly or not is a state. Which CSS classes it has is a state. Etc.

          5) Again, yes

           

          Keep on reading I'd say.