I am having problems with a DataModelSelection.  I have an s:link in a table 
column and when I execute the action, the row data is not being injected into 
the DataModelSelection.  What I am attempting to do is create nested tables 
where an Address list is in the parent table and matching service requests are 
in the child table, so there is no page navigation involved at this point.

Here is the page

        <tr:table  
  |             id="addresses_id"
  |             var="addressRow" 
  |             value="#{foundAddresses}" 
  |             rowBandingInterval="1"
  |             rendered="#{foundAddresses.rowCount>0}"
  |             rowSelection="single"> 
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText 
value="#{msgs['AddressList.addressNumber']}"/>
  |                 </f:facet>
  |                 <s:link id="viewRequests" 
action="#{addressListing.findRequests}" value="View Requests"/>
  | ....

Here is the SFSB
I am Beginning a conversation when the first datamodel(foundAddresses) is 
populated, then ending the conversation when the second (requests) is populated 
via the DataModelSelection(selectedAddress) object from the first DataModel 
(foundAddresses)

@Stateful
  | @Name("addressListing")
  | public class AddressListing implements 
com.stlouiscity.csb.ejb.address.AddressListingLocal {
  |     
  |     @PersistenceContext(unitName="CSB_Oracle", type=EXTENDED)
  |     private EntityManager em; 
  | 
  |     @In(create=true)
  |     private Address address;
  |     
  |     @DataModel("foundAddresses")
  |     private List<StructureAddress> foundAddresses;
  |     
  |     @DataModelSelection(value="foundAddresses")
  |     private StructureAddress selectedAddress;
  |     
  |     @DataModel
  |     private List<ServiceRequest> requests;
  | 
  |     @Out(required=false)
  |     private List<String> streetDirections;
  | 
  |     /**
  |      * Creates a new instance of AddressListing
  |      */
  |     public AddressListing() {
  |     }
  | 
  |     @Begin
  |     public void findAddresses() {
  | 
  |         if (address.getStreetName() != null) {
  |             System.out.println("Address Is NOT NULL");
  |             //Find StructureAddress
  |             Query q = em.createQuery("Select a From StructureAddress a 
Where" +
  |                         " (a.structureAddressPK.houseNumber = :houseNumber 
OR :houseNumber IS NULL) AND" +
  |                         " (a.structureAddressPK.houseSuffix = :suffix OR 
:suffix IS NULL) AND" +
  |                         " (a.nlc.streetDirection = :streetDirection OR 
:streetDirection IS NULL) AND" +
  |                         " (lower(a.nlc.streetName) LIKE :street OR :street 
IS NULL)");
  |             q.setParameter("houseNumber",address.getHouseNumber());
  |             q.setParameter("suffix",address.getHouseSuffix());
  |             q.setParameter("streetDirection",address.getStreetDirection());
  |             q.setParameter("street",address.getStreetName().toLowerCase() + 
"%");
  |       
  |             foundAddresses = q.getResultList();
  |                   
  |         } else if (addressLookup.getAddressLookupId() != null) {
  |             Query query = em.createNamedQuery("Select a from AddressLookup 
where a.addressLookupId = :addressLookupId");
  |             query.setParameter("addressLookupId", 
addressLookup.getAddressLookupId());            
  |             foundAddresses = query.getResultList();         
  |         } else {
  |             System.out.println("Address IS NULL");
  |         }         
  |     }
  |     @End
  |     public void findRequests() {
  |         System.out.println("*********Made it to findRequests*********");
  |         if (selectedAddress != null) {
  |             System.out.println("Selected Address: " + 
selectedAddress.toString());
  |             //Find Request
  |             Query q = em.createQuery("Select p.serviceRequestCollection 
From ParcelAddress p Where" +
  |                         " (p.address = :address)");
  |             q.setParameter("address",selectedAddress);
  |             requests = q.getResultList();        
  |         } else {
  |             System.out.println("Selected Address IS NULL");
  |         } 
  |     }    
  |  
  |     @Factory("streetDirections")
  |     public void fillStreetDirections() {
  |         Query query = em.createQuery("SELECT DISTINCT n.streetDirection 
FROM Nlc n WHERE n.streetDirection IS NOT NULL");
  |         streetDirections = query.getResultList();
  |     }
  |     
  |     @Remove @Destroy
  |     public void destroy() {
  |         
  |     }     
  | }


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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033738
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to