1 Reply Latest reply on Dec 10, 2009 2:42 AM by kapitanpetko

    Help need for simple user registration

      I'm trying to create a simple user registration based on one of the seam examples, but i'm getting the following errors:

      javax.faces.FacesException: javax.el.PropertyNotFoundException: /Register.xhtml @48,101 value="#{RegisterAccountAction.verify}": Property 'verify' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_seam_2
      ......

      and

      21:36:52,812 WARN  [Component] Exception calling component @Destroy method: RegisterAccountAction
      java.lang.IllegalArgumentException: method not found: destroy for component: RegisterAccountAction (check that it is declared on the session bean business interface)
      ......


      @Stateful
      @Scope(ScopeType.EVENT)
      @Name("register")
      public class RegisterAccountAction implements IRegisterAccountAction, Serializable

      {
          @Logger
          private Log log;

          @PersistenceContext
          private EntityManager em;
          @In
          private FacesMessages facesMessages;

          @In User user;
          @In Account account;
          @In(required = false) Role role;

          private String verify;
          private boolean registered;

          public void registerAccountAction()
          {
              //do stuff
          }

         public void invalid()
         {
            facesMessages.add("Please try again");
         }

         public boolean isRegistered()
         {
            return registered;
         }

         public String getVerify()
         {
            return verify;
         }

         public void setVerify(String verify)
         {
            this.verify = verify;
         }

         @Destroy @Remove
         public void destroy() {}
      }

      <html xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
            xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:rich="http://richfaces.org/rich">
      <head>
          <title>Register New User</title>
      </head>

      <body>
      <f:view>
          <h:form>

              <rich:panel>
                  <f:facet name="header">User</f:facet>

                  <s:decorate id="firstNameField" template="layout/edit.xhtml">
                      <ui:define name="label">First Name</ui:define>
                      <h:inputText id="firstNameInput" required="true" value="#{user.firstName}"/>
                  </s:decorate>

                  <s:decorate id="lastNameField" template="layout/edit.xhtml">
                      <ui:define name="label">Last Name</ui:define>
                      <h:inputText id="lastNameInput" required="true" value="#{user.lastName}"/>
                  </s:decorate>

                  <s:decorate id="birthdayField" template="layout/edit.xhtml">
                      <ui:define name="label">Birthday</ui:define>
                      <rich:calendar enableManualInput="false" required="true" value="#{user.birthday}"/>
                  </s:decorate>

                  <div style="clear:both"/>
              </rich:panel>

              <rich:panel>
                  <f:facet name="header">Account</f:facet>

                  <s:decorate id="loginField" template="layout/edit.xhtml">
                      <ui:define name="label">Username</ui:define>
                      <h:inputText id="loginInput" required="true" value="#{account.login}"/>
                  </s:decorate>

                  <s:decorate id="passwordField" template="layout/edit.xhtml">
                      <ui:define name="label">Password</ui:define>
                      <h:inputSecret id="passwordInput" required="true" value="#{account.password}"/>
                  </s:decorate>

                  <s:decorate id="verifyField" template="layout/edit.xhtml">
                      <ui:define name="label">Verify Password</ui:define>
                      <h:inputSecret id="verify" value="#{register.verify}" required="true"/>
                  </s:decorate>

                  <div style="clear:both"/>
              </rich:panel>
            
              <h:commandButton type="submit" value="Register"  action="#{register.registerAccountAction}"/>
          </h:form>
      </f:view>
      </body>
      </html>
      ||
        • 1. Re: Help need for simple user registration
          kapitanpetko

          A few things:



          1. You need to use @Name of the component: #{register.verify}

          2. Define all business methods in the SFSB interface.

          3. Stateful and event scope doesn't really make much sense. Try using the default (conversation scope)

          4. Is destroy() defined in IRegisterAccountAction?

          5. You don't need to implement Serializable in your SFSB



          HTH