Why the form is repeating as many times as the number of fields inside?
bharathiya Aug 23, 2009 8:21 AMI have a very simple seam application with the files provided here below. But when I run it, I see that the form is repeating as many number of times as the number of fields inside the form. I have 8 fields(input text and output texts)and each fields repeats 8 times. When I viewed the html source, the form element is repeating 8 times.
Here below are the source files of the files. Please suggest why is this happening(I am using weblogic 10 MP1):
template.xhtml:
<!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" xmlns:f="http://java.sun.com/jsf/core" xmlns:a="http://richfaces.org/a4j" xmlns:s="http://jboss.com/products/seam/taglib"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Validation</title> <link rel="shortcut icon" href="favicon.ico" /> </head> <body> <div class="body"><ui:insert name="body" /></div> </body> </html>
edit.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib"> <div class="prop"> <s:label styleClass="name #{invalid?'errors':''}"> <ui:insert name="label"/> <s:span styleClass="required" rendered="#{required}">*</s:span> </s:label> <span class="value #{invalid?'errors':''}"> <s:validateAll> <ui:insert/> </s:validateAll> </span> <span class="error"> <h:graphicImage value="/img/error.gif" rendered="#{invalid}" styleClass="errors"/> <s:message styleClass="errors"/> </span> </div> </ui:composition>
user.xhtml:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" template="/layout/template.xhtml" > <ui:define name="body"> <h:messages globalOnly="false" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg" id="globalMessages"/> <h:form id="course" styleClass="edit"> <rich:panel> <h:panelGrid columns="1" border="1"> <s:decorate id="userId" template="layout/display.xhtml"> <ui:define name="label" id="userIdLb">User ...Id</ui:define> <h:outputText id="userId" redisplay="true" value="#{user.userId}" /> </s:decorate> <s:decorate id="firstNameFld" template="layout/edit.xhtml"> <ui:define name="label">First Name:</ui:define> <h:inputText id="firstName" size="50" required="true" maxlength="25" value="#{user.firstName}" > <a4j:support event="onblur" reRender="firstNameFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <s:decorate id="middleNameFld" template="layout/edit.xhtml"> <ui:define name="label">Middle Name:</ui:define> <h:inputText id="middleName" size="50" required="true" maxlength="25" value="#{user.middleName}"> <a4j:support event="onblur" reRender="middleNameFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <s:decorate id="lastNameFld" template="layout/edit.xhtml"> <ui:define name="label">Last Name:</ui:define> <h:inputText id="lastName" size="50" required="true" maxlength="25" value="#{user.lastName}"> <a4j:support event="onblur" reRender="lastNameFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <s:decorate id="dobFld" template="layout/edit.xhtml"> <ui:define name="label">DOB:</ui:define> <h:inputText id="dob" size="50" required="true" maxlength="25" value="#{user.dob}"> <a4j:support event="onblur" reRender="dobFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <s:decorate id="emailFld" template="layout/edit.xhtml"> <ui:define name="label">Email:</ui:define> <h:inputText id="email" size="50" required="true" maxlength="25" value="#{user.email}"> <a4j:support event="onblur" reRender="emailFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <s:decorate id="creditCardFld" template="layout/edit.xhtml"> <ui:define name="label">Credit Card:</ui:define> <h:inputText id="creditCard" size="50" required="true" maxlength="25" value="#{user.creditCard}"> <a4j:support event="onblur" reRender="creditCardFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <s:decorate id="phoneFld" template="layout/edit.xhtml"> <ui:define name="label">Phone:</ui:define> <h:inputText id="phone" size="50" required="true" maxlength="25" value="#{user.phone}"> <a4j:support event="onblur" reRender="phoneFld" ajaxSingle="true" bypassUpdates="true" /> </h:inputText> </s:decorate> <rich:spacer/> <h:commandButton action="#{user.sayWelcome}" value="Say Helsdsdlo !" /> </h:panelGrid> </rich:panel> </h:form> </ui:define> </ui:composition>