0

Possible Duplicate:
h:commandLink / h:commandButton is not being invoked

I have a bean. That bean returns an object:

public class LogoBrick {
    private String logoLink = "link";

    public LogoBrick() {
        System.out.println("LogoBrick");
    }
    public String getLogoLink() {
        return logoLink;
    }
    public void setLogoLink(String logoLink) {
        this.logoLink = logoLink;
    }
    public void save() {
        System.out.println("SUCCESS: " + logoLink);
    }
}

and I want to (in jfs file) invoke the method from this object:

<h:form id="logo-form">
    Logo link: <h:inputText id="logoLink" value="#{brick.logoLink}"/>
    <h:commandButton value="Save" action="#{brick.save()}"/>
</h:form>

The method save and the setter is not invoked but the getter is. Could anyone tell my why? What am I doing wrong?

Community
  • 1
  • 1
micuss
  • 15
  • 2
  • 1
    Your save method should return a string, i think. – Bhesh Gurung Dec 16 '12 at 00:03
  • @BheshGurung that's true for JSF 1.x. Since JSF 2, you can use a `void` method in order to not execute a navigation. – Luiggi Mendoza Dec 16 '12 at 01:17
  • Please add your whole JSF page. With the actual code, it's hard to tell if you have another error that's causing this. – Luiggi Mendoza Dec 16 '12 at 01:19
  • @BheshGurung Event I changed the return type of the method and the result is the same. But I think I've found error. The tag was in bloc but when I removed it, the save method has started to work. – micuss Dec 16 '12 at 09:33

0 Answers0