8 Replies Latest reply on Nov 29, 2006 2:48 AM by Paul Bakker

    Facelets does not submit

    Paul Bakker Newbie

      Hi,
      I have a problem that i can't figure out.
      I just got started with Seam and try to build a really simple form.
      On the page there is a datatable and a button that calls a method on a stateless bean wich prints out a line.

      The page works perfectly when using JSP, but when i try to replace JSP with Facelets things start to be strange.

      The datatable is still working fine with Facelets, but the commandButton doesn't seem to do anything. The page reloads, but my bean's method is never called.

      Thanks in advance.
      This are the relevant files.

      This JSP works fine:

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <f:view>
      <h:form>
       <h:messages />
       test
       <h:dataTable value="#{browseProducts.products}" var="product" >
       <h:column>
       <f:facet name="header">
       <h:outputText value="Product naam" />
       </f:facet>
       <h:outputText value="#{product.name}" />
       </h:column>
       <h:column>
      
       </h:column>
       </h:dataTable>
       <h:commandButton value="Edit" actionListener="#{browseProducts.edit}"/>
      </h:form>
      </f:view>
      


      This facelet doesn't submit...
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html">
      
      <ui:composition template="/template.xhtml">
      
      
       <ui:define name="title">
       Browse Products test
       </ui:define>
      
      
       <ui:define name="body">
       <h:form id="helloForm">
       <h:messages/>
       <h:dataTable value="#{browseProducts.products}" var="product">
       <h:column>
       <h:outputText value="#{product.name}"/>
       </h:column>
       </h:dataTable>
       <h:commandButton type="submit" id="submit" actionListener="#{browseProducts.edit}" value="Submit" />
       <br/>
       </h:form>
       </ui:define>
      
      
      </ui:composition>
      </html>
      


      Facelets template
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Facelets: Number Guess Tutorial</title>
      <style type="text/css">
      <!--
      body {
       font-family: Verdana, Arial, Helvetica, sans-serif;
       font-size: small;
      }
      -->
      </style>
      </head>
      
      <body>
      <h1>
       <ui:insert name="title">Default Title</ui:insert>
      </h1>
      <p>
       <ui:insert name="body">Default Body</ui:insert>
      </p>
      </body>
      
      </html>
      


      Web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <display-name>Seam Buy A Bike</display-name>
      
       <context-param>
       <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
       <param-value>SeamBuyABike/#{ejbName}/local</param-value>
       </context-param>
       <!-- Seam -->
       <listener>
       <listener-class>
       org.jboss.seam.servlet.SeamListener
       </listener-class>
       </listener>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <!-- Special Debug Output for Development -->
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.jboss.seam.core.init.debug</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- Optional JSF-RI Parameters to Help Debug -->
       <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>true</param-value>
       </context-param>
       <servlet>
       <servlet-name>Seam Remoting</servlet-name>
       <servlet-class>
       org.jboss.seam.remoting.SeamRemotingServlet
       </servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Seam Remoting</servlet-name>
       <url-pattern>/seam/remoting/*</url-pattern>
       </servlet-mapping>
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <listener>
       <listener-class>
       org.apache.myfaces.webapp.StartupServletContextListener
       </listener-class>
       </listener>
      
      </web-app>
      


      Faces config
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config
      PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      <faces-config>
       <application>
       <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
       </application>
       <!-- A phase listener is needed by all Seam applications -->
      
       <lifecycle>
       <phase-listener>
       org.jboss.seam.jsf.SeamPhaseListener
       </phase-listener>
       </lifecycle>
      
      </faces-config>
      


        • 2. Re: Facelets does not submit
          Paul Bakker Newbie

          Thanks for the reply, but I still didn't solve the problem.
          I allready had a <h:messages/> on my page, but it doesn't shown anything.
          The other point given in the FAQ is that the component is not found, but my component is found (I can even retrieve values from it).

          However, I found another odd thing that might be usefull to know.
          I added a phaseListener that logs the start and end of each phase.
          On a submit, only the RESTORE_VIEW and RENDER_RESPONSE phases are called. Seems strange to me after a submit.

          • 3. Re: Facelets does not submit
            Paul Bakker Newbie

            This is the logfile when loading the page, and clicking the button.
            There is a line:

            11:02:39,758 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            


            but from what I have read on forums it's completely harmless.


            
            11:02:18,679 INFO [Component] Component: browseProducts, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: buyabike.ejb.session.BrowseProductsBean, JNDI: SeamBuyABike/BrowseProductsBean/local
            11:02:18,679 INFO [Initialization] done initializing Seam
            11:02:18,710 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-seam/server/default/deploy/SeamBuyABike.ear
            11:02:39,399 INFO [STDOUT] BeforePhase: RESTORE_VIEW(1)
            11:02:39,430 INFO [[/SeamBuyABike]] No state saving method defined, assuming default server state saving
            11:02:39,430 INFO [STDOUT] AfterPhase: RESTORE_VIEW(1)
            11:02:39,461 INFO [Pages] reading pages.xml
            11:02:39,461 INFO [STDOUT] BeforePhase: RENDER_RESPONSE(6)
            11:02:39,758 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/jboss-seam/server/default/tmp/deploy/tmp57786SeamBuyABike.ear-contents/SeamBuyABike-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
            11:02:39,789 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/jboss-seam/server/default/tmp/deploy/tmp57786SeamBuyABike.ear-contents/SeamBuyABike-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
            11:02:39,805 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/jboss-seam/server/default/tmp/deploy/tmp57786SeamBuyABike.ear-contents/SeamBuyABike-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
            11:02:39,805 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/jboss-seam/server/default/tmp/deploy/tmp57786SeamBuyABike.ear-contents/SeamBuyABike-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
            11:02:39,805 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/jboss-seam/server/default/tmp/deploy/tmp57786SeamBuyABike.ear-contents/SeamBuyABike-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/seam.taglib.xml
            11:02:39,820 ERROR [STDERR] 12-okt-2006 11:02:39 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/jboss-seam/server/default/tmp/deploy/tmp57786SeamBuyABike.ear-contents/SeamBuyABike-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
            11:02:39,961 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.PRETTY_HTML' found, using default value true
            11:02:39,961 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.ALLOW_JAVASCRIPT' found, using default value true
            11:02:39,961 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.DETECT_JAVASCRIPT' found, using default value false
            11:02:39,961 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.AUTO_SCROLL' found, using default value false
            11:02:39,961 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.ADD_RESOURCE_CLASS' found, using default value org.apache.myfaces.renderkit.html.util.DefaultAddResource
            11:02:39,961 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.CHECK_EXTENSIONS_FILTER' found, using default value true
            11:02:39,992 INFO [STDOUT] AfterPhase: RENDER_RESPONSE(6)
            11:02:40,008 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.PRETTY_HTML' found, using default value true
            11:02:40,008 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.ALLOW_JAVASCRIPT' found, using default value true
            11:02:40,008 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.DETECT_JAVASCRIPT' found, using default value false
            11:02:40,008 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.AUTO_SCROLL' found, using default value false
            11:02:40,008 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.ADD_RESOURCE_CLASS' found, using default value org.apache.myfaces.renderkit.html.util.DefaultAddResource
            11:02:40,008 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.CHECK_EXTENSIONS_FILTER' found, using default value true
            11:03:37,395 INFO [STDOUT] BeforePhase: RESTORE_VIEW(1)
            11:03:37,411 INFO [STDOUT] AfterPhase: RESTORE_VIEW(1)
            11:03:37,411 INFO [STDOUT] BeforePhase: RENDER_RESPONSE(6)
            11:03:37,411 INFO [STDOUT] AfterPhase: RENDER_RESPONSE(6)
            


            • 4. Re: Facelets does not submit
              Pete Muir Master

              Sorry, I didn't read your post properly! The only other thing I noticed was that you were using an actionListener rather than an action which is unusual

              • 5. Re: Facelets does not submit
                Paul Bakker Newbie

                True, but I tried both with the same result.

                • 6. Re: Facelets does not submit
                  Paul Bakker Newbie

                  I started a new project completely from scratch, clean install of JBoss etc.
                  Works without any problem now!
                  I gues i'll never figure out what was wrong the first time, but i'm happy it works now.
                  Thanks for the help.

                  • 7. Re: Facelets does not submit
                    zzzz8 Newbie

                    Hi Paul,

                    Did you ever figure this out (or hazard a guess)? From you last post, I guess you didn't...

                    Anyway, I'm having similar problems (I moved from Tiles to Facelets and I now am encountering this issue) - the h:messages tag doesn't show any errors and look at the phase listener tracker that I have, all phases are hit with no exceptions thrown (at least in the log and while setting breakpoints on ConverterException and ValidatorException)..

                    Is there another way I can debug this? Thanks!

                    • 8. Re: Facelets does not submit
                      Paul Bakker Newbie

                      No i'm sorry, I never found what was wrong with my old project.
                      Maybe it's worth trying to install a clean app. server, and try to deploy to there.