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

    Problem with el parameter in dataTaqble

    amitev

      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.

        • 1. Re: Problem with el parameter in dataTaqble
          g00se24

          Don't know where your direct problem is, but I use;

           <h:dataTable id="clearingchannelsSelectable" value="#{searchuser.selected.clearingChannelTypes}" var="item" >
           <rich:column>
           <a4j:commandLink value="Delete" action="#{clearingchannels.delete(item)}" reRender="clearingchannelsSelectable"/>
           </rich:column>
           </h:dataTable>
          


          and a generic method:
          pubic void select(Object object) {
           setSelected(object);
          }
          


          Cause I use inheritance for seam component I couldn't post a easy to understand example.

          Could it be that the @In destroys the selected obejct?
          @In(required=false) @Out
          

          Try to remove it.
          private Project project;

          • 2. Re: Problem with el parameter in dataTaqble
            amitev

            I've removed it but still doesn't work. Other suggestions?

            • 3. Re: Problem with el parameter in dataTaqble
              dajevtic

              Could it be that you are not in the same conversation?
              Meaning: After the page is displayed, your bean is probably destroyed (also your projects).
              You should begin the conversation in your Factory, not in your select method.
              For the select method use @Begin(join=true), for your factory use @Begin annotation.
              Hope it helps.

              • 4. Re: Problem with el parameter in dataTaqble
                amitev

                That was exactly the problem. Thank you for the help!