[jboss-user] [JBoss Seam] - @DataModel vs. EL

mykey do-not-reply at jboss.com
Sat Feb 2 07:41:22 EST 2008


I am displaying a list of entities (Student) with a @DataModel on a JSF Page with two links: one for editing and one for delting. For some reason the injection by DataModelSelection does not work correctly. My my status-EL messages for these two functions aren't shown correctly. Deletin entities works (except for the status message) whereas editing does not. 

This is my SFSB:

  | @Stateful
  | @Scope(ScopeType.SESSION)
  | @Name("inscription")
  | public class InscriptionAction implements InscriptionFacade {
  | 		
  | 	@Logger private Log log;
  | 	@PersistenceContext(type=PersistenceContextType.EXTENDED) private EntityManager em;
  | 	@DataModel private List<Student> studentList;
  | 	
  | 	@In(required=false)
  | 	@Out(required=false) 
  | 	@DataModelSelection
  | 	private StudentInsc inscribben; // StudentInsc inherits Student
  | 
  | 	public String delete() {
  | //
  | // This log shows only "Deleting inscribben student"
  | //
  | 		log.info("Deleting inscribben student #{inscribben.givenName} #{inscribben.familyName}");
  | 		studentList.remove(inscribben);
  | 		StudentInsc stud = em.merge(inscribben);
  | 		em.remove(stud);
  | 		
  | 		return "insc";
  | 	}
  | 
  | 	public String startEdit() {
  | //
  | // This log shows only "Start editing"
  | //
  | 		log.info("Start editing #{inscribben.givenName} #{inscribben.familyName}");
  | 		em.merge(inscribben);
  | 		return "editInsc";
  | 	}
  | 
  | 	public String finishEdit() {
  | //
  | // This log shows the correct values from the form "Finish editing Newname Newfamilyname"
  | // but doesn't merge the inscribben student to the database
  | //
  | 		log.info("Finish editing #{inscribben.givenName} #{inscribben.familyName}");
  | 		
  | 		em.merge(inscribben);		
  | 		return "insc";
  | 	}
  | 
  | [....]
  | 

This is my table:

  | 
  | <rich:dataTable value="#{studentList}" var="stud" rendered="#{studentList.rowCount>0}" >
  | [....]
  | 
  |  <rich:column><s:link action="#{inscription.startEdit}" value="#{stud.givenName} #{stud.familyName}" /></rich:column>
  | <rich:column><s:link action="#{inscription.delete}" value="delete" /></rich:column>
  | 
  | [....]
  | </rich:dataTable>
  | 
  | 

startEdit redirects to a form, where new values can be entered. On a button click finishEdit is invoked and the DataTable is shown again.

I've already tried a lot, but nothing worked. Can somebody please help me?

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

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



More information about the jboss-user mailing list