2 Replies Latest reply on Feb 27, 2009 4:58 PM by hapacur

    Howto access properties of EntityHome

    hapacur

      Hello,


      just started playing around with seam. There is one thing which I cannot figure out.


      Lets say I have an entity Person somehwere with a string property name. I used the application framework and created the PersonHome class. The JSF page with a form looks something like this:



      <h:inputText value="#{personHome.instance.name}" 
      ..
      <h:commandButton value="Submit" action="#{personHome.persist}">




      Ok, no backing beans. Pretty cool. User enters something in the input Field and when button Submit is pressed the name is stored in the database.


      Now I created another method in the class PersonHome, which should take the value from the inputText field, make it uppercase and persist it. I have no idea how to do that... If I call getInstance in that method, then a new instance is created an the value from the form is lost.



      public String upperCaseAndPersist() {
      String name = getInstance().getName().toUpperCase(); // always null
      getInstance().setName(name);
      return persist();
      }