[jboss-user] [JBoss Seam] - Re: DataModelSelection property not set after using the back

pnorman4 do-not-reply at jboss.com
Thu Feb 22 11:18:59 EST 2007


Actually, I'm using four different @DataModel. Three of these have their own @DataModelSelection.

The page is composed of a page with a table (uses mainListItems). and a small list of selected items (populated by selectedListItems).

The page uses a facelet template, which contains a menu (populated by leftMenuList), and a special list (populated by oPoolItems). 

The main table looks like this (i'm not sending complete xhtml listings for all 6 files yet):

  | <h:dataTable value="#{mainListItems}" var="listItem" id="mooxTable">
  |     <h:column>
  |         <h:outputText value="(#{listItem.localItem.title}) "/>
  |     </h:column>
  | 
  |     <!-- Open -->
  |     <h:column>
  |         <s:link action="#{mainBean.selectListItem}" value="S:Open"/>
  |     </h:column>
  | 
  | </h:dataTable>
  | 

The other lists are rendered in the same way.

The link navigates to a new detail page, with the same template.

The bean looks like this:

  | @Name("mainBean")
  | @Scope(ScopeType.SESSION)
  | public class MainBean extends AbstractSeamBean {
  | 
  |     /* REMOVED: Import of referenced beans */
  | 
  |     /**
  |      * This list contains the select list items.
  |      */
  |     @DataModel
  |     private List<ContentListItem> selectedListItems = new ArrayList<ContentListItem>();
  | 
  |     /**
  |      * This is the current content of the main content area.
  |      */
  |     @Out(required = false)
  |     private ContentListItem currentMainObject = new ContentListItem(0, new MooxMock("Nothing"));
  | 
  |     public boolean isCurrentList() {
  |         return (null != currentMainObject && currentMainObject.getLocalItem() instanceof MooxList);
  |     }
  | 
  | 
  |     /**
  |      * This is the data model for the left menu.
  |      */
  |     @DataModel
  |     private List<ContentListItem> leftMenuList;
  | 
  |     @DataModelSelection("leftMenuList")
  |     private ContentListItem selectedLeftMenItem;
  | 
  |     @Factory("leftMenuList")
  |     public void loadMenu() {
  |     		/* REMOVED: "leftMenuList" initialization */
  |     }
  | 
  |     public String selectLeftMenuItem() {
  |         return setCurrentObject(selectedLeftMenItem);
  |     }
  | 
  | 
  |     /**
  |      * This is the data model for the list view.
  |      */
  |     @DataModel
  |     @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
  |     private List<ContentListItem> mainListItems = new ArrayList<ContentListItem>();
  | 
  |     @DataModelSelection("mainListItems")
  |     private ContentListItem selectedListItem;
  | 
  |     @Factory("mainListItems")
  |     public void updateListItems() {
  |     		/* REMOVED: "mainListItems" initialization */
  |     }
  | 
  |     /**
  |      * Action method used when selecting a list view item.
  |      *
  |      * @return Navigation.
  |      */
  |     public String selectListItem() {
  |         return setCurrentObject(selectedListItem);
  |     }
  | 
  |     /**
  |      * Sets a list item as the new object for the main area.
  |      *
  |      * @param newObject The new object to show in main area.
  |      * @return Navigation.
  |      */
  |     public String setCurrentObject(ContentListItem newObject) {
  |         log.debug("** MainBean - setCurrentObject: #0", currentMainObject);
  | 
  |         currentMainObject = newObject;
  |         updateListItems();
  | 
  |         return (isCurrentList() ? "listSelected" : "objectSelected");
  |     }
  | 
  | 
  |     /**
  |      * O-pool.
  |      */
  |     @DataModel
  |     private List<ContentListItem> oPoolItems;
  | 
  |     @DataModelSelection("oPoolItems")
  |     private ContentListItem selectedOpoolItem;
  | 
  |     @Factory("oPoolItems")
  |     public void updateOPoolItems() {
  |         /* REMOVED: "oPoolItems" initialization */
  |     }
  | 
  |     /**
  |      * Action method used when selecting an O-pool item.
  |      *
  |      * @return Navigation.
  |      */
  |     public String selectOpoolItem() {
  |         return setCurrentObject(selectedOpoolItem);
  |     }
  | 
  | }
  | 

There are no stack traces or errors. 

We're using 
  Seam 1.1.6, MyFaces 1.1.5, Facelets 1.1.12, Ajax4JSF 1.0.6.

/Per

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020670#4020670

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4020670



More information about the jboss-user mailing list