I have this bean in application scope.
public class User {
    private UICommand link;
    private String name;
    public User(){
        System.out.println("User.User()");
        name = "Test Link";
    }
    public UICommand getLink() {
        System.out.println("User.getLink()");
        System.out.println(link==null?"link is null":"link is not null");
        return link;
    }
    public void setLink(UICommand link) {
        System.out.println("User.setLink()");
        this.link = link;
        System.out.println("link: "+link.toString());
    }
    public void change(){
        System.out.println("User.change()");
    }
    //setter and getter for name
}
I have this jsf on jsp page.
<f:view>
<h:form>
<h:commandLink binding="#{user.link}" action="#{user.change}" value="#{user.name}"/>
</h:form>
</f:view>
I thought that the UICommand object would be reused (by sending the serialized state of the object along with the HTML output) and thus maintain the state and binding. But I get this sysoutput.
//When page loads
User.User()
User.getLink()
link is null
User.setLink()
link: javax.faces.component.html.HtmlCommandLink@14e4ce7
//when user clicks the link 
User.setLink()
link: javax.faces.component.html.HtmlCommandLink@6fcc9c
User.change()
UICommand object is different each time the user clicks the link!!! Also i believe getLink() runs only once when that object is first loaded on page but if that's the case then the page woudn't reflect the latest UICommand object!
 
    