1 Reply Latest reply on Apr 8, 2008 12:37 PM by Pete Muir

    Disinject question - non @In attribute is set to null?

    Felix Satyaputra Newbie

      Hi All,

      I have another question on how disinject works on Seam 2.0.1 GA using facelet.

      If I have an attribute that is not annotated with @In, will it be disinjected?

      It seems I have an instance variable which is disinjected even though it's not annotated with @In. Is this an expected behaviour?

      I have the following link:

      <li><s:link id="sftest" view="/sftest/start.xhtml" action="#{formTestPageBean.prepareSave()}" value="Start Sub Form Test"/></li>

      Which fires the following method of the page bean:

      public class FormTestPageBean {
              protected FormManager formManager;
              public String prepareSave() {
                      return "prepareSave";
              // snip...      

      The event is observed by the following class:

      public class CompanyFormGroup extends BaseFormGroup {
              private List<SubForm> completeSubFormList = new LinkedList<SubForm>();
              private Set<SubForm> displaySubForms = new TreeSet<SubForm>(new DisplaySubFormComparator());        
              public void register() {
              public void addSubForm(SubForm subForm) {
                      System.out.println("" + this + ".addSubForm(" + subForm + ") - display size [" + this.displaySubForms.size() + "]");
          // snip...

      which in turn it's observed by the following:

      public class BusinessPremiseSubForm extends BaseSubForm {
              protected CompanyFormGroup companyFormGroup;
              public void register() {
              // snip...

      The output when the link is clicked:

      com.juggle.seam.form.formgroup.base.CompanyFormGroup@964b4d.addSubForm(com.juggle.seam.form.subform.base.BusinessPremiseSubForm@94d605) - display size [1]

      On the I am on the facelet page, I have the following snippet:

              <c:forEach var="e" items="#{formManager.displayFormGroups}">
                      #{e.displaySubForms} <br/>

      The code {e.displaySubForms} gives null, but calling {companyFormGroup.displaySubForms} gives me a collection with BusinessPremiseSubForm.

      I am not sure what's the difference between the two code above.

      Apologies for the long email, and thanks in advance for anyone who has spent time looking at this email.