aspose file tools*
The moose likes JSF and the fly likes What can ui:include include? [almost resolved] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "What can ui:include include? [almost resolved]" Watch "What can ui:include include? [almost resolved]" New topic
Author

What can ui:include include? [almost resolved]

Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
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

Joined: Jan 11, 2011
Posts: 30
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

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
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

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What can ui:include include? [almost resolved]