1 2 Previous Next 18 Replies Latest reply on Aug 23, 2007 9:10 AM by Ilya Shaikovsky

    Submit problem within subtable

    Daniel Ray Newbie

      I have an <a4j:commandButton> within a subtable that is not calling the assigned action. I get the same behavior when trying to use a standard commandLink as well. Is this a known issue or is there another thread that addresses this issue? I see no errors on the server side nor any via a messages tag. Many thanks.

      <rich:datatable ...>

      <rich:subtable ...>

      <rich:column>

      <a4j:commandButton ... />

      ...

        • 2. Re: Submit problem within subtable
          Daniel Ray Newbie

          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker beforePhase
          INFO: BEFORE RESTORE_VIEW(1)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker afterPhase
          INFO: AFTER RESTORE_VIEW(1)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker beforePhase
          INFO: BEFORE APPLY_REQUEST_VALUES(2)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker afterPhase
          INFO: AFTER APPLY_REQUEST_VALUES(2)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker beforePhase
          INFO: BEFORE PROCESS_VALIDATIONS(3)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker afterPhase
          INFO: AFTER PROCESS_VALIDATIONS(3)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker beforePhase
          INFO: BEFORE UPDATE_MODEL_VALUES(4)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker afterPhase
          INFO: AFTER UPDATE_MODEL_VALUES(4)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker beforePhase
          INFO: BEFORE INVOKE_APPLICATION(5)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker afterPhase
          INFO: AFTER INVOKE_APPLICATION(5)
          11 Jul 07 13:50:29, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:29 PM org.exadel.jsf.PhaseTracker beforePhase
          INFO: BEFORE RENDER_RESPONSE(6)
          11 Jul 07 13:50:30, ERROR [http-0.0.0.0-8080-1] util.LoggerStream (LoggerStream.java:152) - Jul 11, 2007 1:50:30 PM org.exadel.jsf.PhaseTracker afterPhase
          INFO: AFTER RENDER_RESPONSE(6)

          • 3. Re: Submit problem within subtable
            Sergey Smirnov Master

            lifecycle is OK.
            Show more code you have of the page.

            • 4. Re: Submit problem within subtable
              Daniel Ray Newbie

              Here's the page fragment. It is included in another page via <jsp:include...>. The offending line is in the subtable.

              <a4j:commandLink value="#{review.member.penName}" action="#{PORTFOLIO.selectReview}" />

              The action in the datatable works just fine.


              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
              <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
              <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
              <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>

              <rich:dataTable value="#{PORTFOLIO.storyList}" var="story">

              <f:facet name="header">
              <rich:columnGroup>
              <rich:column colspan="8">
              <t:outputText value="Story Information" />
              </rich:column>
              <rich:column breakBefore="true">
              <t:outputText value="Date" />
              </rich:column>
              <rich:column>
              <t:outputText value = "Reviewed By" />
              </rich:column>
              <rich:column>
              <t:outputText value="Audience" />
              </rich:column>
              <rich:column>
              <t:outputText value="Genre" />
              </rich:column>
              <rich:column>
              <t:outputText value="Type" />
              </rich:column>
              <rich:column>
              <t:outputText value="Status" />
              </rich:column>
              <rich:column>
              <t:outputText value="Create Date" />
              </rich:column>
              <rich:column>
              <t:outputText value="Last Updated" />
              </rich:column>
              </rich:columnGroup>
              </f:facet>

              <rich:column colspan="8">
              <a4j:commandLink value="Update" action="#{PORTFOLIO.selectStory}">
              <a4j:actionparam name="storyId" value="#{story.id}" assignTo="#{PORTFOLIO.selectedStoryId}" />
              </a4j:commandLink>
              <t:outputText value="#{story.title}" />
              </rich:column>

              <rich:column colspan="2" breakBefore="true" >
              <t:outputText value="Not Yet Reviewed" rendered="#{(story.reviewCount < 1)}" />
              <a4j:commandLink value="Details" rendered="#{(story.reviewCount > 0)}" action="#{PORTFOLIO.selectStory}">
              <a4j:actionparam name="storyId" value="#{story.id}" assignTo="#{PORTFOLIO.selectedStoryId}" />
              </a4j:commandLink>
              </rich:column>

              <rich:column>
              <t:outputText value="#{story.storyAudience.name}" />
              </rich:column>

              <rich:column>
              <t:outputText value="#{story.storyGenre.name}" />
              </rich:column>

              <rich:column>
              <t:outputText value="#{story.storyType.name}" />
              </rich:column>

              <rich:column>
              <t:outputText value="#{story.storyStatus.name}" />
              </rich:column>

              <rich:column>
              <t:outputText value="#{story.createDate}" />
              </rich:column>

              <rich:column>
              <t:outputText value="#{story.lastUpdated}" />
              </rich:column>

              <rich:subTable value="#{story.reviewList}" var="review" rendered="#{(story.id == PORTFOLIO.selectedStoryId)}">

              <rich:column>
              <t:outputText value="#{review.createDate}" />
              </rich:column>

              <rich:column>
              <a4j:commandLink value="#{review.member.penName}" action="#{PORTFOLIO.selectStory}" />
              </rich:column>

              <rich:column colspan="6">
              <rich:spacer height="1" width="1" />
              </rich:column>

              </rich:subTable>

              <rich:column colspan="8">
              <rich:spacer height="12" width="1" />
              </rich:column>

              </rich:dataTable>

              • 5. Re: Submit problem within subtable
                Sergey Smirnov Master

                 

                "budoray" wrote:

                .....
                <rich:subTable value="#{story.reviewList}" var="review" rendered="#{(story.id == PORTFOLIO.selectedStoryId)}">
                .....


                This might be a source of problem. if value of 'rendered' evaluates as a false at the beginning of the second phase, jsf will not process the link.
                What are the scopes for store and PORTFOLIO

                • 6. Re: Submit problem within subtable
                  Daniel Ray Newbie

                  I removed the rendered attribute from the subtable and I still have the same result. I'm befuddled. The lifecycle runs just fine, but the action is never called nor is the assignTo of the actionparam called.

                  • 7. Re: Submit problem within subtable
                    Daniel Ray Newbie

                    PORTFOLIO is a session scoped managed-bean. It contains the storyList (list of Story objects) for the datatable. The Story contains a reviewList (List of Review objects) for the subtable. Neither Story nor Review is a managed-bean.

                    • 8. Re: Submit problem within subtable
                      Sergey Smirnov Master

                      if avoiding the 'rendered' does not help, the scopes do not make sense

                      • 9. Re: Submit problem within subtable
                        Sergey Smirnov Master

                        what the version of Ajax4jsf do you use?

                        • 10. Re: Submit problem within subtable
                          Daniel Ray Newbie

                          My first submission was with richfaces-3.0.1.jar and ajax4jsf-1.1.1.jar.

                          I downloaded the latest snapshots of each and tried them as well. Same issue.

                          • 11. Re: Submit problem within subtable
                            Daniel Ray Newbie

                            I was using the 1.1.1 with richfaces 3.0.1. I have tried this with the latest snapshots from cvs to no avail.

                            Here's a test example:

                            <managed-bean>
                            <managed-bean-name>PRODUCE</managed-bean-name>
                            <managed-bean-class>com.Produce</managed-bean-class>
                            <managed-bean-scope>session</managed-bean-scope>
                            </managed-bean>

                            • 12. Re: Submit problem within subtable
                              Daniel Ray Newbie

                              I was using the 1.1.1 with richfaces 3.0.1. I have tried this with the latest snapshots from cvs to no avail.

                              Here's a test example:

                              <managed-bean>
                               <managed-bean-name>PRODUCE</managed-bean-name>
                               <managed-bean-class>com.Produce</managed-bean-class>
                               <managed-bean-scope>session</managed-bean-scope>
                              </managed-bean>
                              
                              package com;
                              
                              public class Apple {
                               private int id;
                               private String name;
                              
                               public Apple(){
                              
                               }
                              
                               public int getId() {
                               return id;
                               }
                              
                               public void setId(int id) {
                               this.id = id;
                               }
                              
                               public String getName() {
                               return name;
                               }
                              
                               public void setName(String name) {
                               this.name = name;
                               }
                              
                              }
                              
                              package com;
                              
                              import java.util.ArrayList;
                              import java.util.List;
                              
                              import com.Apple;
                              
                              public class Fruit{
                               private String id;
                               private String name;
                              
                               private List<Apple> appleList;
                              
                               public Fruit(){
                               appleList = new ArrayList<Apple>();
                              
                               populate();
                               }
                              
                               private void populate(){
                               for(int i=0; i<5; i++){
                               Apple apple = new Apple();
                               apple.setId(i * 100);
                               apple.setName("Apple Type " + i);
                              
                               appleList.add(apple);
                               }
                               }
                              
                               public String getId() {
                               return id;
                               }
                              
                               public void setId(String id) {
                               this.id = id;
                               }
                              
                               public String getName() {
                               return name;
                               }
                              
                               public void setName(String name) {
                               this.name = name;
                               }
                              
                               public List<Apple> getAppleList() {
                               return appleList;
                               }
                              
                              }
                              
                              package com;
                              
                              import java.util.ArrayList;
                              import java.util.List;
                              
                              public class Produce {
                               private List<Fruit> fruitList;
                              
                               private String selectedAppleId;
                              
                               public Produce(){
                               fruitList = new ArrayList<Fruit>();
                               selectedAppleId = "0";
                               populate();
                               }
                              
                               private void populate(){
                               for(int i=0; i<5; i++){
                               Fruit fruit = new Fruit();
                               fruit.setId("" + i * 10);
                               fruit.setName("Apple");
                              
                               fruitList.add(fruit);
                               }
                               }
                              
                               public String selectApple(){
                               System.out.println("Selected Apple Id: " + selectedAppleId);
                              
                               return "";
                               }
                              
                               public List<Fruit> getFruitList() {
                               return fruitList;
                               }
                              
                               public void setSelectedAppleId(String selectedAppleId) {
                               this.selectedAppleId = selectedAppleId;
                               }
                              
                              }
                              
                              <%@ page session="false" contentType="text/html;charset=utf-8"%>
                              
                              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                              <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                              <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
                              <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
                              <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                              
                              <html>
                              
                               <f:view>
                              
                               <t:documentHead>
                               <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
                               </t:documentHead>
                              
                               <t:documentBody>
                              
                               <h:form id="produce_form">
                              
                               <rich:dataTable id="produce_list" value="#{PRODUCE.fruitList}"
                               var="fruit">
                              
                               <f:facet name="header">
                               <rich:columnGroup>
                               <rich:column>
                               <t:outputText value="Fruit Id" />
                               </rich:column>
                               <rich:column>
                               <t:outputText value="Fruit Name" />
                               </rich:column>
                               </rich:columnGroup>
                               </f:facet>
                              
                               <rich:column id="fruit_id_column">
                               <t:outputText value="#{fruit.id}" />
                               </rich:column>
                              
                               <rich:column id="fruit_id_name">
                               <t:outputText value="#{fruit.name}" />
                               </rich:column>
                              
                               <rich:subTable value="#{fruit.appleList}" var="apple">
                              
                               <rich:column>
                               <t:outputText value="" />
                               </rich:column>
                              
                               <rich:column>
                               <a4j:commandLink value="#{apple.name}" action="#{PRODUCE.selectApple}">
                               <a4j:actionparam name="appleId" value="#{apple.id}" assignTo="#{PRODUCE.selectedAppleId}" />
                               </a4j:commandLink>
                               </rich:column>
                              
                               </rich:subTable>
                              
                               </rich:dataTable>
                              
                               </h:form>
                              
                               </t:documentBody>
                              
                               </f:view>
                              
                              </html>
                              
                              
                              


                              • 13. Re: Submit problem within subtable
                                Daniel Ray Newbie

                                I dug a little deeper and found this was reported by mladen.babic on 07-01-07.

                                • 14. Re: Submit problem within subtable
                                  Daniel Ray Newbie

                                  My workaround is to add an additional column with breakBefore = true followed by another column with colspan spanning the remaining columns and nesting another datatable in this column, which by the way, gives me the ability to add headers.

                                  <rich:column breakBefore="true">
                                   <t:outputText />
                                  </rich:column>
                                  
                                  <rich:column>
                                   <rich:dataTable id="fruit_list" value="#{fruit.appleList}" var="apple">
                                   <rich:column id="fruit_name_column">
                                   <a4j:commandLink value="#{apple.name}" action="#{PRODUCE.selectApple}">
                                   <a4j:actionparam name="appleId" value="#{apple.id}" assignTo="#{PRODUCE.selectedAppleId}" />
                                   </a4j:commandLink>
                                   </rich:column>
                                   </rich:dataTable>
                                  </rich:column>
                                  


                                  1 2 Previous Next