s:decorate and h:panelGrid
deichblach Jun 16, 2010 2:59 AMHello,
I'm fairly new to seam and tried to create a nice looking form using s:decorate in combination with h:panelGrid.
My problem is that it seems to me that h:panelGrid and s:decorate are incompatible. s:decorate expands
after h:panelGrid has already drawn the table around it. I even debugged the renderer of h:panelGrid to see that the s:decorate tag has not been rendered
, when the renderer calculates which tag to place in which cell. So as a result each input field with its label and error message is placed within one cell of the table rendered by panelGrid. I would expect that s:decorate is expanded
before panelGrid is rendered.
Has anybody tried this before? Is there a simple way to solve this problem?
I'm using Seam 2.2.0 GA + RichFaces 3.3.3 + jsf-facelets 1.1.14 + Sun JSF Implementation 1.2.12
Here is my page:
<ui:composition template="/WEB-INF/layout/template.xhtml"> <ui:define name="body"> <h:form id="createUser"> <rich:panel> <f:facet name="header"> #{messages['userAdministration.addUserHeader']} </f:facet> <h:panelGrid columns="3"> <s:decorate enclose="false" template="/WEB-INF/components/inputField.xhtml"> <ui:define name="label">#{messages['user.userAliasLabel']}</ui:define> <h:inputText id="userAlias" label="#{messages['user.userAliasLabel']}" value="#{newUser.userAlias}" required="true" /> </s:decorate> <s:decorate enclose="false" template="/WEB-INF/components/inputField.xhtml"> <ui:define name="label">#{messages['user.userPasswordLabel']}</ui:define> <h:inputText label="#{messages['user.userPasswordLabel']}" id="password" value="#{newUser.password}" required="true" /> </s:decorate> <s:decorate enclose="false" template="/WEB-INF/components/inputField.xhtml"> <ui:define name="label">#{messages['user.userPasswordConfirm']}</ui:define> <h:inputText id="passwordConfirm" label="#{messages['user.userPasswordConfirm']}" required="true" > <s:validateEquality for="password" /> </h:inputText> </s:decorate> <h:commandButton action="#{userAdministration.add(newUser)}" value="#{messages['userAdministration.createUser']}"/> </h:panelGrid> </rich:panel> </h:form> ...
The following is the simple template for the inputFields:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib"> <s:label styleClass="#{invalid?'error':''}"> <ui:insert name="label"/> </s:label> <s:validateAll> <ui:insert/> </s:validateAll> <s:message styleClass="error" for="#{field}"/> </ui:composition>