[jboss-user] [JBoss Seam] - Re: Multiple select items in page scope with factories.
christian.andersson
do-not-reply at jboss.com
Mon Oct 30 10:28:20 EST 2006
"christian.andersson" wrote : Hi all,
|
| I have an issue with multiple @SelectItems and factories.
|
| Environment
|
| jboss-4.0.4.GA
| Seam 1.1.0.beta1
| selectitems 1.0.1rc1
|
|
| In my SFSB I have these @SelectItems
|
| @SelectItems(value = "selectProjectManagers", scope = ScopeType.PAGE, label = "name", strategy = SelectItems.Strategy.INDEX)
| | private List<User> projectManagers;
| |
| | @SelectItems(value = "selectCustomers", scope = ScopeType.PAGE, label = "name", strategy = SelectItems.Strategy.INDEX)
| | private List<Customer> customers;
| |
| | @SelectItems(value = "selectBusinessAreas", scope = ScopeType.PAGE, label = "name", strategy = SelectItems.Strategy.INDEX)
| | private List<BusinessArea> businessAreas;
|
| I have three factories for these
|
|
| | @Factory("selectProjectManagers")
| | public void getProjectManagers()
| | {
| | projectManagers = userManager.getUsersInRoles(new String[] { SystemRole.PROJECT_ADMINISTRATOR });
| | }
| |
| | @Factory("selectBusinessAreas")
| | public void getBusinessAreas()
| | {
| | businessAreas = systemManagerBean.getBusinessAreas();
| | }
| |
| | @Factory("selectCustomers")
| | public void getCustomers()
| | {
| | customers = customerManager.getCustomers();
| | }
|
| and finally a page that displays these select items on a page as drop downs.
|
|
|
| | <h:outputLabel for="customer">Project Manager:</h:outputLabel>
| | <h:selectOneMenu value="#{projectWebManager.projectManager}">
| | <f:selectItems value="#{selectProjectManagers}"/>
| | </h:selectOneMenu>
| |
| | <h:outputLabel for="customer">Customer:</h:outputLabel>
| | <h:selectOneMenu value="#{projectWebManager.customer}">
| | <f:selectItems value="#{selectCustomers}"/>
| | </h:selectOneMenu>
| |
| | <h:outputLabel for="customer">Business Area:</h:outputLabel>
| | <h:selectOneMenu value="#{projectWebManager.businessArea}">
| | <f:selectItems value="#{selectBusinessAreas}"/>
| | </h:selectOneMenu>
|
| When I debug this I can see that only the factory associated with the first of the three dropdowns (selectProjectManagers) is called. If I put the selectCustomers dropdown before the selectProjectManagers dropdown the selectCustomers factory is called.
|
|
| Note: The first call to the page loads all three, it is on the second call to the page that only the first factory gets called.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981787#3981787
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981787
More information about the jboss-user
mailing list