[jboss-user] [JBoss Seam] - Facelets does not submit

paul@xfact.nl do-not-reply at jboss.com
Thu Oct 12 03:38:36 EDT 2006


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>
  | 

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

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



More information about the jboss-user mailing list