4 Replies Latest reply on Jun 27, 2007 12:08 PM by Adrian Mitev

    Problem with el parameter in dataTaqble

    Adrian Mitev Master

      Hi all! I have the following code:

      ejb for populating the dataTable

      @Stateful
      @Name("projectSearch")
      public class ProjectSearchBean implements com.amitev.bts.ejb.ProjectSearchLocal {
      
       @PersistenceContext
       private EntityManager em;
      
       @DataModel
       private List<Project> projects;
      
       @Factory("projects")
       @SuppressWarnings("unchecked")
       public void retrieveProjects() {
       projects = em.createQuery("from Project").getResultList();
       }
      ..........
      


      The web page with the dataTable:

      <h:dataTable var="proj" value="#{projects}">
       <h:column>
       <s:link value="#{proj.name}" action="#{projectBrowse.selectProject(proj)}" />
       </h:column>
      </h:dataTable>
      


      And the projectBrowse bean
      @Stateful
      @Name("projectBrowse")
      public class ProjectBrowseBean implements com.amitev.bts.ejb.ProjectConversationLocal {
      
       @PersistenceContext(type=PersistenceContextType.EXTENDED)
       private EntityManager em;
      
       @In(required=false) @Out
       private Project project;
      
       private Issue issue;
      
       @Begin
       public void selectProject(Project selectedProject) {
       System.out.println("selectedProject: " + (selectedProject==null));
       }
       ....
      


      But when i click on the link in the dataTable, null is passed to the selectProject method. The url looks like this:

      .../project/list.jsf?actionMethod=pages%2Fproject%2Flist.xhtml%3AprojectBrowse.selectProject%28proj%29&cid=2&dataModelSelection=proj%3Aprojects%5B0%5D

      Idea why null is passed to the action method. I saw this code in seam 1.2.1 booking demo so i suppose it has to work.