14 Replies Latest reply on Feb 6, 2007 2:35 PM by Norman Richards

    multiple component instances in one page

    Stephan Oudmaijer Newbie

      Allright, I might be asking something dumb, but: I have build a simple helloworld application. Below is the component:

      @Name("helloworld")
      public class Helloworld {
      
       private DumbUser dumbUser;
      
       public String sayHello() {
       System.out.println("sayHello");
       return "success";
       }
      
       public DumbUser getDumbUser() {
       System.out.println("retrieving user");
       return dumbUser;
       }
      
       public void setDumbUser(DumbUser dumbUser) {
       System.out.println("setting user");
       this.dumbUser = dumbUser;
       }
      }
      


      And this simple class

      
      public class DumbUser {
      
       private String name;
      
       public DumbUser() {
       }
      
       public String getName() {
       return name;
       }
      
       public void setName(String name) {
       this.name = name;
       }
      }
      
      


      This is the JSF page:

       <h:form id="helloworld">
       <div>
       <h:inputText value="#{helloworld.dumbUser.name}"/>
       <h:commandButton type="submit" value="sayHello!" action="#{helloworld.sayHello}"/>
       </div>
       </h:form>
      
      


      When I hit the button, the helloworld.sayHello is never triggered. I can`t figure out why. helloworld.getDumbUser is called but then execution stops.

      Uhm, what am I doing wrong?