1 Reply Latest reply on May 31, 2007 3:42 PM by Ryan Levering

    JavaBean injection

    Ryan Levering Newbie

      For a particular very complex grid-like view, I use a factory method to set a large two-dimensionsal javabean array where each javabean is non-Seam managed POJO - a description of what to render in that grid:

      private GridSlot[][] slots;
      public void createSlots() {

      I then use facelet methods to iterate across the grid and draw it to the screen. It all works fine. The problem is I need certain parts of the grid to redraw based on other grid changes.

      Each one of these grid squares contains a h:selectOneMenu like:
      <ui:repeat value="#{slots}" item="row">
      <ui:repeat value="#{row" item="slot">
      <h:selectOneMenu value="#{slot.id}" valueChangeListener="#{myAction.updateGrid}" onchange="submit()" />

      When something in the selection box changes, the form submits correctly and I get good event values in the updateGrid method. In addition, when the view is redrawn post submit, the changed slot information is reflected, which makes me believe that the bijection is working on some level. However, in the updateGrid method, the local variable "slots" does not actually have updated properties. I had many theories about why this is happening, but many attempts to fix this (making the POJO seam managed, playing with injection type, etc.) haven't changed anything.

        • 1. Re: JavaBean injection
          Ryan Levering Newbie

          In the interest of answering my own question, it turns out it the backing bean wasn't being updated because another h:selectOneMenu wasn't validating correctly. I was using a Map to populate the select menu and it was erroring out with a strange value not valid error, which meant it skipped the update model phase. I changed my f:selectItems to use a SelectItem[] and the problem went away.