I am new to jsf and facing some issues dealing with it.
I am making a simple jsp file which is backed by a class.
Every Component I am using the page is bounded to some property in the backing java class.
and In the class
Now on the value change listener event of some other component in the same page ,
i have to update the value of this field.
I am using following code in the valueChangeListener method of the event causing component.
But I am getting NullPointerException at this line.
Please explain me how to remove this.
Also what is the difference between value and binding attribute of the jsf component?
Is it ok to bind every form component to a property in the managed bean?
JSF is different. I don't like to even use the term "JSP" in JSP, because the ".jsp" files in JSF aren't really JSP files, just JSF View definitions whose filename extension just happens to be ".jsp".
Binding is something that I think was required in the early days when JSF was still being designed and the documentation ended up polluting the Internet forevermore. These days, the only really good excuse for using binding is if you plan to dynamically build GUI elements on the webpage - a practice that itself is generally not encouraged. For the most part, your programming will be simpler and cleaner if you use "value=" attributes instead. You you tried, in fact, won't work, because binding is done to a JSF UIComponent object, not to a data properly. I recommend getting a good book on JSF.
Like Binding, Listeners are also used over-much. You don't need to use them to set properties. JSF will set your properties from the view directly without you needing to code anything other than a POJO property-set method in the backing bean. Listeners do have their uses, but they mostly are needed for things like updating cascaded drop-down lists of the country/state/city variety and not for simple data access.
Customer surveys are for companies who didn't pay proper attention to begin with.