On 10/27/10 12:29 AM, Cay Horstmann wrote:
> Sure, that's great. Except, it should probably be f:doctype since it
> is not HTML specific.
I think that the idea is that it shouldn't be in h: because it applies
to all SGML-derived languages.
-- Blake
I think f:doctype works. Though we do seem to be blurring the lines
a
bit between the h: and f: tag libraries. The old JSP taglib doc for
h: says:
> This tag library contains JavaServer Faces component tags for all
> UIComponent + HTML RenderKit Renderer combinations defined in the
> JavaServer Faces Specification.
And doc for the f: taglib:
> The core JavaServer Faces custom actions that are independent of any
> particular RenderKit.
These descriptions seem to be accurate for 1.2. As of 2.0 we have
started adding tags into the f: taglib that actually do have
corresponding Renderers (or ClientBehaviorRenderers) in the HTML_BASIC
standard render kit. (I am thinking of f:viewParam and f:ajax.)
Would f:doctype be similar to f:viewParam in that we would introduce a
new component + Renderer in the HTML_BASIC render kit?
> Or, if we cared about consistency with JSP, we could use the same
> attributes as jsp:output:
>
> <f:doctype omit-xml-declaration="no"
> doctype-root-element="html"
> doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
>
>
doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional...
>
Ah, good old jsp:output. The highlight of my day was reviewing this
reference doc:
http://java.sun.com/products/jsp/syntax/2.0/syntaxref2022.html
My favorite part:
> The JSP container will not include the XML declaration in the output
> when either of the following is true:
>
> You set the omit-xml-declaration attribute of the jsp:output element
> to either true or yes.
> You have a jsp:root element in your JSP document, and you do not
> specify omit-xml-declaration="false" in jsp:output.
>
> The JSP container will include the XML declaration in the output when
> either of the following is true:
>
> You set the omit-xml-declaration attribute of the jsp:output element
> to either false or no.
> You do not have a jsp:root action in your JSP document, and you do
> not specify the omit-xml-declaration attribute in jsp:output.
I had the same reaction to this that Bart Simpson had to "Don't do
what Donnie Don't Does": They could have made this clearer. [1] :-)
If we do follow a jsp:output-like solution, I think that we would want
to:
- Separate out the XML declaration part. This doesn't seem to make
sense on an f:doctype tag.
- Massage the attribute names to be more in line with JSF naming
conventions, eg. "rootElement", "public", "system"
The XML declaration part is interesting on its own. When running in
the new XML/JSPX processing modes, we do not want to pass this through
by default - ie. the XML declaration pertains to the Facelets document
itself, not to the generated content. However, when rendering
text/xhtml content, we do want to render an XML declaration so that
our rendered document will be valid XML. Rather than requiring the
page author to provide a hint to control this behavior (like
jsp:output's omit-xml-declaration attribute), I would prefer that the
RenderKit/ResponseWriter detect this case and handle it in a
transparent manner. Does this sound reasonable/doable?
Andy
[1]
http://www.snpp.com/episodes/1F06.html