Seam clickable list executing action listener mutiple times
browndogg33 Mar 27, 2008 10:18 PMI am having problems calling an action listener method from a seam link inside of an h:datatable.
Here is my table:
<h:dataTable id="organizations" value="#{organizations}" var="org" rendered="#{organizations.rowCount>0}" styleClass="taglib roll" width="100%"> <h:column> <f:facet name="header">Business Name & Address</f:facet> <s:link id="viewOrg" value="#{org.name}" propagation="none" action="#{account.selectOrganization(org)}"/> <br/> #{org.address1} <br/> #{org.city}, #{org.state} #{org.zip} <br/> </h:column> <h:column> <f:facet name="header">Org Code</f:facet> #{org.code} </h:column> <h:column> <f:facet name="header">Creation Date</f:facet> <h:outputText value="#{org.creationDate}"> <f:convertDateTime type="date" dateStyle="medium" /> </h:outputText> </h:column> </h:dataTable>
... and the corresponding SFSB
@Stateful @Name("account") @Scope(ScopeType.SESSION) @Restrict("#{identity.loggedIn}") public class AccountAction implements Serializable, Account { @PersistenceContext(type=EXTENDED) private EntityManager em; @Logger private Log log; @In(required=false) @Out private PAAMSOrganization org; @DataModel List<PAAMSUser> users; @DataModel List<SalesLocation> locations; @Remove public void destroy() {} @Begin(join=true) public void selectOrganization(PAAMSOrganization selectedOrg) { PAAMS paams = PAAMS.getInstance(); log.info(selectedOrg.getName()); users = selectedOrg.getUsers(); String sql = "select * from location where org_id = ? and active_flag = ?"; Query q = em.createNativeQuery(sql, SalesLocation.class); q.setParameter(1, selectedOrg.getId()); q.setParameter(2, "Y"); locations = q.getResultList(); for(SalesLocation sl:locations){ System.out.println(sl.toString()); } org = selectedOrg; }
When I click the link from the page, it is calling selectOrganization() mutiple times. Any help would be greatly appreciated.