[jboss-user] [JBoss Seam] - Seam JSF controls do not work in external Facelet templates

nagypalg do-not-reply at jboss.com
Tue Sep 11 03:56:05 EDT 2007


When I use the following in a Facelet XHTML file, it works perfectly, validates the input, and shows the error message if validation fails:

<s:decorate id="telefonNummer" template="/layout/edit.xhtml">
  |        <ui:define name="label">#{messages['wbe.adresse.telefonNummer']}</ui:define>
  |        <h:inputText id="telefonNummerInput" size="50" maxlength="50"
  |         value="#{adresseEditor.instance.telefonNummer}" required="true">
  |         <a:support event="onblur" reRender="telefonNummer"/>
  |        </h:inputText>
  |       </s:decorate>

(/layout/edit.xhtml is the file generated by seamgen)

If I extract this fragment to a facelet composite and include it by ui:include or declare it as a facelet tag, it still validates, but the validation error messages show up only in the log, but not in the GUI. I get messages like this in the log:
anonymous wrote : INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
  | sourceId=adresse:telefonNummerInput[severity=(WARN 1), summary=(Größe muss zwischen 5 und 50 liegen), detail=(Größe muss zwischen 5 und 50 liegen)]

The external template is the following:

<!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:c="http://java.sun.com/jstl/core"
  |  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
  |  xmlns:s="http://jboss.com/products/seam/taglib"
  |  xmlns:a="https://ajax4jsf.dev.java.net/ajax"
  |  xmlns:fa="http://www.disy.net/cadenza/fa">
  | <ui:composition>
  |  <c:set var="messageKey" value="wbe.#{entity}.#{property}" />
  |  <c:set var="labelMessage" value="#{messages[messageKey]}" />
  |  <c:if test="#{empty maxLength}">
  |   <c:set var="maxLength" value="#{size}" />
  |  </c:if>
  |  <c:if test="#{empty special}">
  |   <c:set var="special" value="false" />
  |  </c:if>
  |  <c:if test="#{special}">
  |   <c:set var="propInstance" value="#{editor[property]}" />
  |  </c:if>
  |  <c:if test="#{not special}">
  |   <c:set var="propInstance" value="#{editor.instance[property]}" />
  |  </c:if>
  |  <c:if test="#{empty reRender}">
  |   <c:set var="reRender" value="#{property}" />
  |  </c:if>
  |  <c:if test="#{empty required}">
  |   <c:set var="required" value="false" />
  |  </c:if>
  |  <s:decorate id="#{property}" template="/layout/edit.xhtml">
  |   <ui:define name="label">
  |    <h:outputText value="#{labelMessage}" />
  |   </ui:define>
  |   <h:inputText id="#{property}Input" size="#{size}"
  |    maxlength="#{maxLength}" value="#{propInstance}">
  |    <a:support event="onblur" reRender="#{reRender}"
  |     required="#{required}" />
  |   </h:inputText>
  |  </s:decorate>
  | </ui:composition>
  | </html>

and I invoke it as:

<fa:inputText editor="#{adresseEditor}" entity="adresse" property="telefonNummer" size="50" required="true"/>

The HTML code that is generated by the inline version (working) and the template/tag version (does not work) seems to be identical.

I also had problems with the s:link tag: it worked when I used it directly in a facelet template and stopped working in an external composite template.

My question: is it a known issue? If yes, is it intended, i.e., Seam JSF controls should not be used in facelet components? If not, will it be (has it been) corrected in Seam 2? Or is there a workaround also for Seam 1.2.1?

My setup: SUN RI 1.2, Tomcat 5.5, Seam 1.2.1GA


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

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

More information about the jboss-user mailing list