0

I have a problem with the JSF-2.0 templating mechanism. I implement some snippet that are included to template file. But one of my snippet contains dynamic content.

I do not get an error. But nothing is replaced in my snipplet! The result do only contain "No link list could be found" string. Do anybody know why?

Thanks

The snippet code

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets">
    <div>
    <ui:insert name="linkList">No link list could be found</ui:insert> 
    </div>
    © MyCompany
</ui:composition>

The template code

  ...
  <div class="footer">
    <ui:insert name="footer">Footer</ui:insert>
  </div>
  ...

The side where specify the template content

...
<ui:define name="footer">
  <ui:include src="/snippets/footer.xhtml" />
</ui:define>
...
<ui:define name="linkList">
link structure for the footer
</ui:define>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Jonny Schubert
  • 1,393
  • 2
  • 18
  • 39
  • Related: http://stackoverflow.com/questions/4792862/how-to-include-another-xhtml-in-xhtml-using-jsf-2-0-facelets `` requires an ``. – BalusC Sep 29 '11 at 14:33

1 Answers1

1

The following line you have in snippet is -

<ui:insert name="linkList">No link list could be found</ui:insert>

is for templating and it should be in the template.

Include the snippet in the same way you have included the footer. Using

<ui:include src="snippet.xhtml" />
Bhesh Gurung
  • 50,430
  • 22
  • 93
  • 142
  • If I get the gist of you post you want to say that it is not possible to habe a tag in a file that is included because is only for templates – Jonny Schubert Sep 29 '11 at 12:40
  • @JonnySchubert: Yes. That's what I think. Because our view (not the snippet) uses a template by having `ui:composition template="atemplate.xhtml"` somewhere at the beginning, so JSF will aware of that template-template_client relation and replaces `ui:insert` in template with `ui:define` in template-client. And the snippet is neither a template nor a template-client. – Bhesh Gurung Sep 29 '11 at 13:21