[jboss-user] [JBoss Seam] - Re: [2.0.0.CR1] selectManyListbox + convertEntity yields con

pete.muir@jboss.org do-not-reply at jboss.com
Mon Oct 1 10:14:20 EDT 2007


Use

addStudent.xhtml

  | <s:validateAll>
  |   <h:outputLabel for="studentlist" value="Pick students" />
  |   <h:selectManyListbox id="studentlist" size="14" required="true" value="#{workgroupStudentManager.workgroupSelectedStudents}">
  |     <s:selectItems value="#{workgroupAvailableStudents}" var="student" label="#{student.firstName} #{student.prefix} #{student.lastName}"/>
  |     <s:convertEntity/>
  |   </h:selectManyListbox>
  | </s:validateAll>
  | 

WorkgroupStudentDetail.java

  | @Stateful
  | @Name("workgroupStudentManager")
  | @Scope(ScopeType.CONVERSATION)
  | @Conversational
  | public class WorkgroupStudentDetail implements WorkgroupStudentDetailInterface {
  | 	@In
  | 	private EntityManager entityManager;
  | 
  | 	@In(required = false)
  | 	@Out(required = false)
  | 	private Collection<Person> workgroupAvailableStudents;
  | 		
  | 	private Collection<Person> workgroupSelectedStudents;
  |         // Getters and setters for workGroupSelectedStudents
  | 	
  | 	@Begin (join = true, flushMode = FlushModeType.MANUAL)
  | 	@Factory("workgroupAvailableStudents")
  | 	public void findStudents() {
  | 		try {
  | 			workgroupAvailableStudents = (Collection<Person>) entityManager.createQuery("SELECT DISTINCT Object(per) FROM Person per").getResultList();
  | 		} catch (Exception e) {
  | 			log.error("Exception occurred in findStudents() [WorkgroupStudentDetail].", e);
  | 		}
  | 	}
  | 
  | 	// ..
  | }
  | 

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

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



More information about the jboss-user mailing list