1 Reply Latest reply on Feb 17, 2008 2:05 PM by Pete Muir

    Injection of non-Entity bean failing

    Brett Gladys Newbie

      I have a simple application that I've set up, with a feature to perform searches. I've created a POJO to hold the search values:

      @Name("sCriteria")
      public class SearchCriteria implements java.io.Serializable{
      
       private static final long serialVersionUID = 4249273907087086393L;
       private String orderId;
       private String actNumber;
      ...
      


      I set the value on my .xhtml page:

      <h:panelGrid columns="2">
      <h:outputText value="Act Number"/>
      <h:inputText value="#{sCriteria.actNumber}"></h:inputText>
      <h:outputText value="Order Number"/>
      <h:inputText value="#{sCriteria.orderId}"></h:inputText>
      <h:commandButton type="submit" action="#{spojoAction.doAction(sCriteria)}" value="Search Orders - Param"></h:commandButton>
      <h:commandButton type="submit" action="#{spojoAction.doAction}" value="Search Orders - @In"></h:commandButton>
      


      When I debug the code, and look at, in this case a Seam POJO:

      @Name("spojoAction")
      public class SPOJOAction {
      
       @Logger
       Log log;
      
       private OrderStaticDataLiteDao orderStaticDataLiteDao;
      
       @In
       private SearchCriteria sCriteria;
      
       @Out(required = false, scope = ScopeType.PAGE)
       List<OrderStaticDataLite> ordersList;
      
       public String doAction(){
       orderStaticDataLiteDao = new OrderStaticDataLiteDao();
       return null;
       }
      
       public String doAction(SearchCriteria searchCriteria){
       orderStaticDataLiteDao = new OrderStaticDataLiteDao();
       return null;
       }
      


      the values I set on my .xhtml page are null. The interesting part is that if I examine either the @In-jected object, or the one passed in via the parameter(depending on the button clicked), the values I entered on the .xhtml page seem to be present in the handler. IE, both sCriteria and searchCriteria show the following:

      sCriteria.handler.bean.actNumber = the value entered on the .xhtml page
      sCriteria.handler.bean.orderId = the value entered on the .xhtml page
      searchCriteria.handler.bean.actNumber = the value entered on the .xhtml page
      searchCriteria.handler.bean.orderId = the value entered on the .xhtml page

      It seems to me that something is strange with the interception of these values. Does anyone have any ideas?

      Note, I've also tried adding @Interceptors(SeamInterceptor.class) at the top of my Seam pojo, but saw the same behavior.

      Thanks.