2 Replies Latest reply on Aug 4, 2006 7:58 AM by Philipp Taprogge

    In attribute requires value for component

    Philipp Taprogge Newbie

      Hi!
      I am totally confused...
      I am working with an existing Seam application running inside JBoss Portal (JBoss 4.0.4.GA, EJB3 rc8, Portal 2.4.0.CR3) with the MyFacesGenericPortlet.
      All existing components work.
      Now I tried to add a new component and get said error.
      I have stripped it down in trying to find the cause, but had no luck.
      Perhaps one of you can tell me what I am doing wrong.

      This is my POJO to hold the entered information. Even scoping it "SESSION" did not make any difference.

      @Name("userinput")
      @Scope(SESSION)
      public class UserInput {
      
       private String username;
       private String password;
      
       public String getPassword() {
       return password;
       }
       public void setPassword(String aPassword) {
       this.password = aPassword;
       }
       public String getUsername() {
       return username;
       }
       public void setUsername(String aUsername) {
       this.username = aUsername;
       }
      }
      


      This is my SessionBean:

      @Stateful
      @Conversational(ifNotBegunOutcome = Outcome.REDISPLAY)
      @Scope(CONVERSATION)
      @Name("usercreate")
      public class UserActionBean implements UserAction {
      
       private static Logger logger = Logger.getLogger(UserActionBean.class);
      
       @PersistenceContext(type = EXTENDED)
       private EntityManager em;
      
       @In(create = true)
       private UserInput theUser;
      
       @Begin
       public String beginStuff() {
       logger.info("begin called");
       logger.info("Data so far: username="
       + theUser.getUsername());
       return Outcome.REDISPLAY;
       }
      
       @Remove
       @Destroy
       public void destroy() { }
      }
      


      And this is the jsp I use as default view for the portlet:

      <f:view>
      <h:form>
      <table border="0">
       <tr>
       <td align='left'>username:</td>
       <td><h:inputText id="username"
       value="#{userinput.username}"
       required="true" />
       <h:message style="color:red" for="username" /></td>
       </tr>
       <tr>
       <td align='left'>password:</td>
       <td><h:inputText id="password"
       value="#{userinput.password}"
       required="true" />
       <h:message style="color:red" for="password" /></td>
       </tr>
       <tr>
       <td height='60' align='left'>
       <h:commandButton type="submit" value="create user"
       action="#{usercreate.beginStuff}" /></td>
       <td align="right"><input type="reset" value="reset"></td>
       </tr>
      </table>
      <h:messages style="color:red" />
      </h:form>
      </f:view>
      


      Now, entering no information at all results (correctly) in "required" messages to be displayed for each field.
      Entering any data and hitting the button results in a
      org.jboss.seam.RequiredException: In attribute requires value for component: usercreate.theUser
      

      being thrown.

      Any thoughts?

      Regards, Phil