• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What can ui:include include? [almost resolved]

 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using JSF 2.0.6.
I know I can include pages using <ui:include> tag and I know how to do this. I ask about contents of included page.
Can it start like this?
<?xml version='1.0' encoding='UTF-8' ?>
<h:panelGroup xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">


Or maybe it has to start with ui:composition?
<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">


Is it necassary to include doctype declaration as well?
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


All of these work, but are there any requirements? I can't find anything about it in JSF specification. I tried searching PDF for "doctype" and "ui:include".
 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, my investigation took me there:
Looking for ui: tags specification JSF2.0 specification says:
This tag library is the specified version of the ui: tag library found in pre JSF 2.0 Facelets. The specification for this
library can be found in the VDLDocs for the ui: library.

I found it here: http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/ui/include.html
It says:
There are three things this tag can include: plain XHTML, and XHTML pages that have either a composition tag or a component tag.

Seems like all of my propositions are right.
Anyway, are there any drawbacks of not including doctype within included pages?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DOCTYPE specifies a DTD. DTDs are deprecated. The XSD form (xmlns) is the preferred way to go these days.

DTDs are better than nothing, but they're not subtle enough to do fine-grained XML validation and they can't handle multiple document namespaces.
 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! But then it's strange that the most recent NetBeans with the most recent Java EE 6 with the most recent JSF2.1 still creates a new JSF pages with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
;]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not the DOCTYPE for the facelet resource definition, though, it's the DOCTYPE that will be output to the client on the resulting webpage. You only want/need/can use that on the outer view definition - the one that contains the actual "html" element. It's not applicable to included objects, only the page as a whole.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic