0 Replies Latest reply on Jan 20, 2009 9:43 PM by Nazmi Demirci

    Seam action problem

    Nazmi Demirci Newbie
      Hello
      i am using Jboss Tools. i have a user entity and registerAction.

      `
      @Entity
      @Name("User")
      public class user implements Serializable
      {
          // seam-gen attributes (you should probably edit these)
          private Long id;
          private Integer version;
          private String name;

          // add additional entity attributes

          // seam-gen attribute getters/setters with annotations (you probably should edit)

          @Id @GeneratedValue
          public Long getId() {
              return id;
          }

          public void setId(Long id) {
              this.id = id;
          }

          @Version
          public Integer getVersion() {
              return version;
          }

          private void setVersion(Integer version) {
              this.version = version;
          }

          @Length(max = 20)
          public String getName() {
              return name;
          }

          public void setName(String name) {
              this.name = name;
          }

      }

      `

      `
      @Scope(ScopeType.SESSION)
      @Name("registerAction")
      public class RegisterAction
      {
          @Logger private Log log;

          @In StatusMessages statusMessages;
         
          @In protected user newUser;
         
          @In protected EntityManager entityManager;

          public void registerAction()
          {
              // implement your business logic here
              log.info("registerAction.registerAction() action called");
              statusMessages.add("registerAction");
             
          }

          public String register(){
              entityManager.persist(newUser);
              return "/userList.xhtml";
             
          }
          // add additional action methods

      }

      And this register action not working. i am trying action=#{registerAction.register()} and  i am getting below errors :

      `
      22:28:11,718 ERROR [application] org.jboss.seam.RequiredException: @In attribute requires non-null value: registerAction.newUser
      javax.faces.el.EvaluationException: org.jboss.seam.RequiredException: @In attribute requires non-null value: registerAction.newUser
              at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
              at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
              at javax.faces.component.UICommand.broadcast(UICommand.java:387)
              at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
              at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
              at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
              at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)


      What is problem ?