1 Reply Latest reply on Jan 3, 2007 7:33 AM by jdijkmeijer

    simple question on update

    jdijkmeijer Newbie


      I've a very simple use case I'm trying to implement but I cant get it to work. Its too simple for words:
      I have a list with a few entities (subjects in my case) and clicking on one of them should bring me to the nextpage where I can make some modifications, and than return to my list to see the modifications in the list.
      To achieve this I made a subjectManagerBean, implement subjectManager; with, among others, the following declarations:

       private Subject subject;
       List<Subject> subjectList;

      In the list page I successfully render the list:
       <h:dataTable id="subjectList" var="subject"
       rendered="#{subjectList.rowCount > 0}">
       <h:commandLink value="#{subject.lastname}" action="#{subjectMgr.select}"/>

      clicking one the required lastname field I go to the edit page:
       public String select() {
       if (subject == null) {
       log.error("subject is null");
       return "selectSubject";

      the edit page looks something like:
       <h:form id="subject">
       <div class="dialog">
       <s:button id="update" value="update"
       rendered="#{not empty subject.firstname}"/>
       <h:commandButton id="update2" value="Save Cmd"
       rendered="#{not empty subject.firstname}" />

      and the managerbean has the persist method to update the subject: (Although I'm not sure thats needed).
       public String persist() {
       if (subject == null) {
       log.error("in persistence subject is null");
       } else {
       log.info("persisting" + subject.getEmail());
       return "success";

      Now I have 2 questions:
      1 the h:commandbutton doesnt do anything, no update, no errors, no messages: nada I can only see the id changing from the db id to '0' why?
      2 the s:button brings me to the persist message only to find out that the subject is null, how does this happen?

      I think its a very simple, elementary question but I've been looking in the docs, faqs etc and couldnt find anything, I'm afraid i'm doing something very stupid here, but nevertheless any help would be greatly appreciated.


      jboss 4.0.5.GA
      seam 1.1GA
      windows XP sp2
      mysql 5.?