2 Replies Latest reply on Nov 26, 2012 5:16 AM by Fab Mars

    rich:editor and facelet pages problem

    Antonio Gurisatti Newbie

      Hi,

      I found a problem using rich:editor in a facelet environment. I build cruds this way:

      1. A very simple holder page that uses ui:include to swap list and edit pages:

      <!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:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:s="http://jboss.com/products/seam/taglib">
      
       <ui:composition template="/templates/top-menu-template.xhtml">
       <style>
       </style>
       <ui:define name="body">
       <h:panelGrid id="comCntrl" columns="1" style="margin: 0px auto;"
       headerClass="tituloPagina">
       <ui:include src="#{planIndicatorCurrValueController.activePage}" />
       </h:panelGrid>
       </ui:define>
       </ui:composition>
      
      </html>
      
      


      The "Backing Bean" is in charge of deciding witch page to show.

      2. If the edit page (a ui:composition page) has a rich:editor, it is not rendered.

      I found a way to solve this problem by adding a "fake" rich:editor to the "holder page" so it looks like:

      <!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:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:s="http://jboss.com/products/seam/taglib">
      
       <ui:composition template="/templates/top-menu-template.xhtml">
       <style>
       </style>
       <ui:define name="body">
       <rich:editor width="0" height="0" rendered="false"/>
       <h:panelGrid id="comCntrl" columns="1" style="margin: 0px auto;"
       headerClass="tituloPagina">
       <ui:include src="#{planIndicatorCurrValueController.activePage}" />
       </h:panelGrid>
       </ui:define>
       </ui:composition>
      
      </html>
      


      Now, the editor is rendered and works correctly.

      Looks like a JS loading problem ?

      Or most likely I am doing something wrong.

      I would appreciate very much any comment on this