I\'m using Glassfish 3.2.2 and JSF 2.1.11
I\'m trying to create a composite component that will take as parameters a string and a max number of characters and then w
Basically, you should be overridding UIComponent#saveState() and restoreState() according their documentation when you add custom properties/attributes to the component which should survive across multiple HTTP requests on the same view. The component instance is namely recreated on every request.
Since JSF 2.0, much better is to use the StateHelper directly in the attribute getters/setters. It's available by the inherited UIComponent#getStateHelper() method.
private enum PropertyKeys {
expanded;
}
public void toggleExpanded() {
setExpanded(!isExpanded());
}
public void setExpanded(boolean expanded) {
getStateHelper().put(PropertyKeys.expanded, expanded);
}
public boolean isExpanded() {
return (boolean) getStateHelper().eval(PropertyKeys.expanded, false);
}