[jboss-user] [JBoss Seam] - @DataModel doesn't load the first time

james_hays@mac.com do-not-reply at jboss.com
Fri Feb 16 13:54:35 EST 2007


Hey guys, I have an interesting issue with @DataModel.  I don't believe I have changed anything after I had this working when I moved to Seam 1.1.6

What I have is a search page that takes some data on page a, enters an action listener, runs a query against the database and outjects the value through @DataModel to be used on page b.  The values are coming back from the database and populating the instance value correctly, but my xhtml won't see the data until I hit refresh page 5.

Here's a few code snippets.


  | @Name("search")
  | @Stateless
  | public class SearchAction implements Search
  |     {
  |     @Logger
  |     private Log log;
  | 
  |     @PersistenceContext
  |     private EntityManager em;
  | 
  |     @Out
  |     @In
  |     ProfileRecord profileRecord;
  | 
  |     @DataModel
  |     private List<ProfileRecord> searchResults;
  | 
  |     @DataModelSelection("searchResults")
  |     private ProfileRecord currentProfileRecord;
  | 
  |     public String basicSearch()
  |         {
  |         log.info("Running Basic Search");
  |         ProfileRecord pr = new ProfileRecord();
  |         pr.setWaNumber(profileRecord.getWaNumber());
  |         pr.setProposalNumber(profileRecord.getProposalNumber());
  |         profileRecord = pr;
  |         searchResults = em.createQuery("Select pr from ProfileRecord pr where pr.waNumber LIKE :waNumber")
  |                 .setParameter("waNumber", pr.getWaNumber() + "%")
  |                 .getResultList();
  |         log.info("Profile Records Found: " + searchResults.size());
  |         return "/detailedSearch.seam";
  |         }
  | 
  | 

  | 	<ui:define name="content">
  | 				<div class="tabularData">
  |                     <h:dataTable cellpadding="0" cellspacing="0" value="#{searchResults}" var="currentProfileRecord" rules="all" width="100%">
  | 					<h:column>
  | 						<f:facet name="header">WA #</f:facet>
  | 						<h:outputText value="#{currentProfileRecord.waNumber}" />
  | 					</h:column>
  | 					<h:column>
  | 						<f:facet name="header">SBU</f:facet>
  | 						???
  | 					</h:column>
  | 

When this page loads the first time, the table with the DataModel is empty.  as soon as I refresh the page, it's there.  I've run the debugger and the list is populated the first time through.

Any thoughts on what might be causing this?

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

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



More information about the jboss-user mailing list