3 Replies Latest reply on Feb 21, 2008 7:23 PM by jimk1723

    Multiple parse on JSF page

    xtof83

      Hi,


      so what I want be able to do is:


      I have xml in my database, I parse it with freemaker, to create a dynamic form.


      Now, I want to inject JSF in it, so it make me easy to get the user choice when he submit the form.


      but my JSF for now, is not parsed...


      How can I say, to my application to reparsed the page, to make the JSF workable...


      Thx

        • 1. Re: Multiple parse on JSF page
          jimk1723

          It'd help to see where your at with some existing code, but I'll take a crack at it...


          You should be able to do this with the Facelet's ui:include. I'm assuming you've got your Freemarker servlet set up in web.xml, something like:


           <servlet-mapping>
            <servlet-name>freemarkerServlet</servlet-name>
            <url-pattern>*.fm</url-pattern>
           </servlet-mapping>
          



          And all of your Freemarker templates are generating JSF like so:


          <div xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
           <h:outputText value="This was included!" />
          </div>
          



          So if you have a Freemarker template in your /view folder you can include it in a JSF page using


          <ui:include src="/includepage.fm" />
          



          Of course, in this simple example there's nothing stopping some one from getting http://yourserver/includepage.fm which could lead to shenanigans.

          • 2. Re: Multiple parse on JSF page
            pmuir

            I think that facelets loads off disk, not using URLs like that.


            I think you would need to implement a custom FaceletsResourceResolver for this.

            • 3. Re: Multiple parse on JSF page
              jimk1723

              Doh! Yup, doesn't work. My own example was too simple.