0 Replies Latest reply on Aug 28, 2008 11:56 AM by Tim Morgan

    EL does not work in Javascript block

    Tim Morgan Newbie

      Hi!


      I would like to use a <ui:repeat> in a javascript block to fill an array with values from a bean property but the code is not parsed.


      Relevant parts of my code:


      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <!-- left out rest of header -->
      
      <script type="text/javascript">
      /* <![CDATA[ */      
      
              var createWizards = new Array();
              <ui:repeat value="#{articleManager.createWizards}" var="wizard">
                      createWizards['#{wizard.value}'] = '#{wizard.name}';
              </ui:repeat>
                      
      /* ]]> */
      </script>
      
      <!-- left out body -->
      




      That is my output:


      <script type="text/javascript">
      //<![CDATA[
      
              var createWizards = new Array();
              <ui:repeat value="[ArticleCreateWizardNormal:4sk671b-ppz0vk-fkf5ujf6-1-fkf6rf4u-18, ArticleCreateWizardKultur:4sk671b-ppz0vk-fkf5ujf6-1-fkf6rf5a-19, ArticleCreateWizardTemplate:4sk671b-ppz0vk-fkf5ujf6-1-fkf6rf5a-1a, ArticleCreateWizardXlinkRedirect:4sk671b-ppz0vk-fkf5ujf6-1-fkf6rf5a-1b]" var="wizard">
              createWizards[''] = '';
              </ui:repeat>
      
      //]]>
      </script>
      



      You can see that the CDATA part is commented out different from the original code and there is nothing but the tags and the serialized object.


      BTW, the <ui:repeat> loop works fine outside of the javascript block so I wonder if there is a possibility to use tags inside such a block.


      Interestingly in another SEAM project here there is no problem doing this. In this working code they left out /* <![CDATA[ */ and /* ]]> */ which I tried as well in my example but then my xhtml file is not well formed any more.


      I switched facelets.SKIP_COMMENTS from true to false in the web.xml but that has no effect.


      Removing the prolog in the first line does not change anything either.


      Maybe someone has an idea.


      Thanks!


      Haefti