1 Reply Latest reply on Jul 13, 2011 5:38 PM by dstilton

    Injection not working as expected

    dstilton
      Hi,
      I am new to Seam, and I'm having trouble getting a simple injection proof of concept to work. I have an xhtml page, a POJO, and an action class.  Once I get to my action class, my injected POJO object isn't hydrated.  I know an instance of the POJO is getting hydrated because I'm getting to that breakpoint.  However, my injected Object must be a new reference or something. The files in question are below.  Thanks.


      -- resendEmail.xhtml --

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <f:view xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:a="http://richfaces.org/a4j"
              xmlns:s="http://jboss.com/products/seam/taglib"
              contentType="text/html">

           <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

                <h:form id="resendEmail">
                
                <table>
                
                  <tr>
                    <td>Detail ID:</td>
                    <td>
                        <h:inputText  id="detailId" value="#{mailerResend.dtlId}" size="15"/>
                    </td>
                  </tr>
                
                </table>
                
                <h:commandButton type="submit" id="resendEmail" value="ResendEmail"
                                 action="#{mailerBuilder.buildMailer}"/>
                </h:form>
           </html>
      </f:view>


      -- MailerResend.java --


      @Scope(ScopeType.SESSION)
      @Name("mailerResend")
      public class MailerResend {
           private Integer dtlId;     
           
           public Integer getDtlId() {
                return dtlId;
           }
           
           public void setDtlId(Integer dtlId) {
                this.dtlId = dtlId;
           }
      }


      -- MailerBuilderAction.java --

      @Scope(ScopeType.SESSION)
      @Name("mailerBuilder")
      public class MailerBuilderAction {
           
           @In
           private MailerResend mailerResend; // this is not a hydrated object???
           
           public void buildMailer(){
                Mailer mailer = new Mailer();
                mailer.setBillingEmail(mailerResend.getBillingEmail());
           }
      }