[jboss-user] [JBoss Seam] - Re: <s:decorate /> with template property?

fhh do-not-reply at jboss.com
Mon Jun 4 15:46:44 EDT 2007


Here's the code of the form:


  | <!DOCTYPE html 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:ui="http://java.sun.com/jsf/facelets"
  | 	xmlns:f="http://java.sun.com/jsf/core"
  | 	xmlns:h="http://java.sun.com/jsf/html"
  | 	xmlns:c="http://java.sun.com/jstl/core"
  | 	xmlns:s="http://jboss.com/products/seam/taglib"
  | 	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
  |     template="/WEB-INF/templates/standard.xhtml">
  | 
  |   <ui:define name="title">Title</ui:define>
  | 
  |   <ui:define name="body">
  | <h:form>
  |   <rich:toolBar height="26" itemSeparator="line">
  |   
  |    	  <rich:toolBarGroup rendered="#{not mitgliedHome.managed}">
  | 		  <h:commandLink action="#{mitgliedHome.persist}"><h:graphicImage value="/images/button_ok.png" /><h:outputText value="Save" /></h:commandLink>
  | 	  </rich:toolBarGroup>  	  
  | 	 
  | 	</rich:toolBar>
  |   
  |    <h:messages globalOnly="true"/>
  |    
  |    <s:decorate template="decorateField.xhtml">
  |         <ui:define name="label">Username:</ui:define>
  |         <h:inputText value="#{userHome.instance.name}" required="true"/>
  |    </s:decorate>
  |       
  |           </h:form>
  | 
  |   </ui:define>
  |   
  |  </ui:composition>
  | 
  | 

And the decorateField.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>
  |     
  |         <s:label styleClass="#{invalid?'error':''}">
  |             <ui:insert name="label"/>
  |             <s:span styleClass="required" rendered="#{required}">*</s:span>
  |         </s:label>
  |         
  |         <span class="#{invalid?'error':''}">
  |             <!-- <h:graphicImage src="img/error.gif" rendered="#{invalid}"/>  -->
  |             <s:validateAll>
  |                 <ui:insert />
  |             </s:validateAll>
  |         </span>
  |         
  |         <s:message styleClass="error"/>
  |         
  |     </div>
  |     
  | </ui:composition>
  | 

The result looks like this:
http://felix.dyndns.tv/static/s-decorate-error.png

Regards

Felix

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

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



More information about the jboss-user mailing list