"wrong root element" error in facelets

Hi,

in facelets I have a problem, I get the following message see image:
wrong_root.png

But if i remove doctype, then error is gone. In Netbeans is all fine.

How can I resolve this problem?


Thanks.

3 comments
Comment actions Permalink

Hello.

I may be not enough familiar with facelets. Is that true that ui:composition element should be the root element, like on your screenshot? Samples I've found in Net all shows the ui:composition inside html element. Why not to do so?

Regards,
Alexander.

0
Comment actions Permalink

HI,

i found this:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.   <body>
  3.     THIS LINE, AND EVERYTHING ABOVE IT IS DISREGARDED BY JSF

  4.     <ui:composition template="/layout.xhtml">
  5.       <ui:define name="title">#{msgs.contactsWindowTitle}</ui:define>
  6.       <ui:define name="heading">#{msgs.contactsHeading}</ui:define>
  7.       <ui:define name="content">
  8.         <ui:include src="contactsTable.xhtml" />
  9.       </ui:define>
  10.         
  11.     </ui:composition>
  12.     THIS LINE, AND EVERYTHING BELOW IT IS DISREGARDED BY JSF
  13.   </body>
  14. </html>


at: http://docs.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/ui/composition.html
or: https://facelets.java.net/nonav/docs/dev/docbook.html#template-composition

Cheers

0
Comment actions Permalink

Hi.

But in this sample ui:composition is not root, the root is <html>. This sample is highlighted correctly in IDEA, providing the file is xhtml and JSF support is added.

Regards,
Alexander.

0

Please sign in to leave a comment.