2 Replies Latest reply on May 17, 2007 10:54 AM by Tony Mai

    Data entry's backing bean not picking up entries on form

    Tony Mai Apprentice

      Hello,

      I have a situation where I am not sure how to debug it. Please help.

      I have an entry form where entry fields are mapped to a bean as followed:

      entry.xhtml

      <h:inputText id="teTradeId" value="#{tradeEntry.exchTradeId}" required="true" >
      ...
      <a4j:commandButton value="Add" action="#{tradeMgr.addTradeEntry}" reRender="tradeReportingPanel" />
      ...


      entry bean:
      @Name("tradeEntry")
      @Scope(ScopeType.SESSION)
      public class TdTradeEntry implements Serializable {
       private String exchTradeId;
      
       @NotNull
       public String getExchTradeId() ...
      
       public void setExchTradeId(String exchTradeId) ...
      


      backing bean:
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("tradeMgr")
      public class TradeManagerBean implements TradeManager, Serializable {
      ...
       @In @Out
       private TdTradeEntry tradeEntry;
      
       public void addTradeEntry() {
       // tradeEntry is always null in here
       x = tradeEntry.getExchTradeId();
      ...
       public TdTradeEntry getTradeEntry()...
      
       public void setTradeEntry(TdTradeEntry tradeEntry)...
      
      }


      For whatever reason, the injection of tradeEntry is always null which Seam would throw exception as

      Caused by: javax.ejb.EJBTransactionRolledbackException: org.jboss.seam.RequiredException: In attribute requires non-null value: tradeMgr.tradeEntry


      If I was to declare the injection for tradeEntry with qualifier as (create=true) such as
      @In(create=true) @Out private TdTradeEntry tradeEntry;


      When I did this, all the fields in tradeEntry would be null.

      Am I doing something wrong with this model?

      Thanks for your help.
      -tony