[jboss-user] [JBoss Seam] - Re: show me the right way to access row of datatable with Se

tim_ph do-not-reply at jboss.com
Thu Aug 2 11:33:54 EDT 2007


Holly cow! Today, it just works. No problem at all. You are my lucky star, Pete.
I removed all the clutters, and leave minimal code in there. Even though I don't like the part where I have to use single string name for Factory, I have to use it for now rather spend more time on this.
Here's complete code

  | <h:outputLabel value="No Personnel assigned yet" rendered="#{empty personnels}"/>	
  |  <rich:dataTable var="personnel" 
  | 	                   value="#{personnels}" 
  | 	                   rendered="#{not empty personnels}"
  | 	                   rowClasses="rvgRowOne,rvgRowTwo"
  | 	                   id="personnelTable">
  | 	            <h:column>
  | 	                <f:facet name="header">action</f:facet>
  | 	                <h:commandLink value="Select" action="#{applicationHome.selectPersonnel}"/>
  | 	            </h:column>
  | </rich:dataTable>
  | 

and ApplicationHome.java

  | @Name("applicationHome")
  | public class ApplicationHome extends EntityHome<Application>
  | {
  | ...
  | 	@DataModel
  | 	private List<Personnel> personnels;
  | 
  |         @Factory("personnels")
  | 	public void fillPersonnels()
  | 	{
  | 		if (personnels == null)
  | 			personnels = getInstance() == null ? null : new ArrayList<Personnel>(getInstance().getPersonnels());
  | 	}
  | 
  | 	@DataModelSelection
  | 	private Personnel personnel;
  | 
  |         @Logger Log log;
  | 
  |        public void selectPersonnel() 
  |       {
  |          if (personnel == null) log.info("personnel is null");
  |          else log.info("you have selected personnel " + personnel.getName());
  |       }
  | }
  | 

Using s:link and s:button will reload the whole page, so I have to use h:commandLink and h:commandButton. personnel can then be used to display more info on the same page.
Thank you guys, smithbstl and Pete.

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

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



More information about the jboss-user mailing list