ACTION: Review and comment by 23:59 EDT 17 August 2010.
Proposal for XML JSF Views
https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=490
SECTION: Modified Files
----------------------------
M jsf-api/doc/standard-html-renderkit-base.xml
M jsf-api/doc/standard-html-renderkit.xml
M jsf-ri/src/main/resources/com/sun/faces/standard-html-renderkit-impl.xml
M jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/html/HtmlLibrary.java
A jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/TitleRenderer.java
A jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HtmlRenderer.java
- New standard components
+ <component-type>javax.faces.OutputHtml</component-type>
+ <component-class>javax.faces.component.html.Html</component-class>
+ <component-type>javax.faces.OutputTitle</component-type>
+
<component-class>javax.faces.component.html.HtmlTitle</component-class>
- New standard renderers
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>javax.faces.Html</renderer-type>
This operates exactly like h:head and h:body except that it renders
<html>. It also allows resources to be output, in the same way as
h:head and h:body.
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>javax.faces.Title</renderer-type>
This just outputs <title> and </title>
A jsf-api/doc/web-facesview_2_1.xsd
- This simple schema is necessary to declare the root node, on which the
XML namespaces to be used in a Facelets XML View document must be
declared.
It is essentially the following:
+ <xsd:element name = "faces-view"
type="javaee:faces-viewType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The "faces-view" element is the root of the UIComponent
hierarchy,
+ and contains nested elements for all
+ of the other components.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ </xsd:element>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name = "faces-viewType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Extension element for faces-view. It may contain
+ implementation specific content.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:any namespace="##any"
+ processContents="lax"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
M jsf-api/src/main/java/javax/faces/application/ViewHandler.java
- make constant DEFAULT_SUFFIX be
+ public static final String DEFAULT_SUFFIX = ".xhtml .view.xml .jsp";
M jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java
A jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml
A jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java
A jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/NoOpHandler.java
- add XmlLibrary and a tag handler for <faces-view>. This lets us have
faces views in XML, as shown in the example section.
M jsf-ri/systest/web/WEB-INF/web.xml.template
- necessary context params to make it generate valid HTML when the only
thing accessed is a .view.xml page.
+
<context-param>
+ <param-name>com.sun.faces.autoCompleteOffOnViewState</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.FACELETS_SUPPRESS_XML_DECLARATION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
A jsf-ri/systest/web/view.xml
A jsf-ri/systest/web/view.xml/index.view.xml
- See example section
SECTION: index.view.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-view
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesview_2_1.xsd"
version="2.1"
xmlns:h="http://java.sun.com/jsf/html">
<h:html>
<h:head><h:title>Raw XML View</h:title></h:head>
<h:body>
<h:form>
<h:panelGrid column="2">
<h:outputText value="hello"></h:outputText>
<h:commandButton
value="reload"></h:commandButton>
</h:panelGrid>
</h:form>
</h:body>
</h:html>
</faces-view>
Here is an HTTP transaction log for this view.
++++++CLIENT REQUEST:
GET
http://localhost:8080/jsf-systest/view.xml/index.faces HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.6)
Gecko/20100625 Firefox/3.6.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.7,de;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Cookie: JSESSIONID=848d17af367c6b905f4b650bee7c
-----PROXY RESPONSE:
HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0
Server: GlassFish v3
X-Powered-By: JSF/2.0
Set-Cookie: JSESSIONID=85198d4e88aaced7c0a028544010; Path=/jsf-systest
Content-Type: text/html;charset=UTF-8
Content-Length: 507
Date: Thu, 12 Aug 2010 22:00:32 GMT
Connection: close
<html><head><title>Raw XML View</title></head><body>
<form id="j_idt6" name="j_idt6" method="post"
action="/jsf-systest/view.xml/index.view.faces"
enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt6" value="j_idt6" />
<input type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState" value="j_id1:j_id2" />
<table>
<tbody>
<tr>
<td>hello</td>
</tr>
<tr>
<td><input type="submit" name="j_idt6:j_idt9"
value="reload" /></td>
</tr>
</tbody>
</table>
</form></body></html>
---
For some unknown reason, this *does not* render in Safari or Chrome
(WebKit browsers). It renders fine in Firefox. Any ideas?
Ed
SECTION: Diffs
----------------------------
Index: jsf-api/doc/standard-html-renderkit-base.xml
===================================================================
--- jsf-api/doc/standard-html-renderkit-base.xml (revision 8552)
+++ jsf-api/doc/standard-html-renderkit-base.xml (working copy)
@@ -996,6 +996,20 @@
<component>
<description>NONE</description>
+ <display-name>html</display-name>
+ <component-type>javax.faces.OutputHtml</component-type>
+ <component-class>javax.faces.component.html.Html</component-class>
+
+ <xi:include href="i18n-props.xml"
xpointer="xpointer(/root/*)"/>
+
+ <component-extension>
+ <base-component-type>javax.faces.Output</base-component-type>
+ <renderer-type>javax.faces.Html</renderer-type>
+ </component-extension>
+ </component>
+
+ <component>
+ <description>NONE</description>
<display-name>head</display-name>
<component-type>javax.faces.OutputHead</component-type>
<component-class>javax.faces.component.html.HtmlHead</component-class>
@@ -1010,6 +1024,20 @@
<component>
<description>NONE</description>
+ <display-name>title</display-name>
+ <component-type>javax.faces.OutputTitle</component-type>
+
<component-class>javax.faces.component.html.HtmlTitle</component-class>
+
+ <xi:include href="i18n-props.xml"
xpointer="xpointer(/root/*)"/>
+
+ <component-extension>
+ <base-component-type>javax.faces.Output</base-component-type>
+ <renderer-type>javax.faces.Title</renderer-type>
+ </component-extension>
+ </component>
+
+ <component>
+ <description>NONE</description>
<display-name>body</display-name>
<component-type>javax.faces.OutputBody</component-type>
<component-class>javax.faces.component.html.HtmlBody</component-class>
@@ -3484,6 +3512,70 @@
</renderer-extension>
</renderer>
+<renderer>
+ <description><![CDATA[<div
class="changed_added_2_1">
+
+<p><span class="changed_modified_2_1">Render</span> the
markup for
+a <code><html></code> element.</p>
+
+ <p>Decode Behavior</p>
+
+ <ul>
+
+<p>No action is required during decode for this renderer.</p>
+
+</ul>
+
+ <p>Encode Behavior</p>
+
+ <ul>
+
+<p>Render the starting <code><html></code> element tag.
Any
+attributes declared on the element must be passed through unmodified to
+the rendered output. At some
+point before rendering the closing <code></html></code>
element
+tag, render any resources that have been targeted for this "html"
+element:
+ <ul>
+ <li>Obtain a <code>UIViewRoot</code> instance.</li>
+ <li>Obtain a <code>List</code> of component resources targeted
for
+ this "html" element with a call to
<code>UIViewRoot.getComponentResources()</code>
+ with the <code>String "html"</code> as the
argument.</li>
+ <li>Iterate over the returned <code>List</code> of
<code>UIComponent</code> instances
+ and call <code>encodeAll</code> on each
<code>UIComponent</code> instance.
+
+<p>Any attributes declared on the element must be passed through
+unmodified to the rendered output.</p>
+
+ </ul>
+
+ <p>Note that due to the cascading nature of CSS files, the order
+ in which these files have been added to the view must be preserved
+ when rendering the references to the files within the
+ <code><head></code> element. Also, the end result of
the
+ rendered <code><head></code> section must be that any
CSS
+ files referenced due to previous calls to
+ <code>addComponentResource()</code> do not adversely interfere
+ with any CSS files manually placed in this section by the page
+ author.</p>
+
+ <p>Render the ending <code></html></code> element
tag.</p>
+
+</div>]]></description>
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>javax.faces.Html</renderer-type>
+ <renderer-class>
+ <xi:include href="standard-html-renderkit-impl.xml"
xpointer="xpointer(/root/output-html-renderer-class/text())"/>
+ </renderer-class>
+
+ <xi:include href="i18n-attrs.xml"
xpointer="xpointer(/root/*)"/>
+
+ <renderer-extension>
+ <jsp-ignore>true</jsp-ignore>
+ <tag-name>html</tag-name>
+ </renderer-extension>
+ </renderer>
+
<renderer>
<description><![CDATA[<div
class="changed_added_2_0">
@@ -3553,6 +3645,47 @@
</renderer>
<renderer>
+ <description><![CDATA[<div
class="changed_added_2_1">
+
+<p><span class="changed_modified_2_0_rev_a">Render</span> the
markup for
+a <code><title></code> element.</p>
+
+ <p>Decode Behavior</p>
+
+ <ul>
+
+<p>No action is required during decode for this renderer.</p>
+
+</ul>
+
+ <p>Encode Behavior</p>
+
+ <ul>
+
+<p>Render the starting <code><title></code> element tag.
Any
+attributes declared on the element must be passed through unmodified to
+the rendered output.</p>
+
+ <p>Render the ending <code></title></code> element
tag.</p>
+
+</div>
+
+</div>]]></description>
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>javax.faces.Title</renderer-type>
+ <renderer-class>
+ <xi:include href="standard-html-renderkit-impl.xml"
xpointer="xpointer(/root/output-title-renderer-class/text())"/>
+ </renderer-class>
+
+ <xi:include href="i18n-attrs.xml"
xpointer="xpointer(/root/*)"/>
+
+ <renderer-extension>
+ <jsp-ignore>true</jsp-ignore>
+ <tag-name>title</tag-name>
+ </renderer-extension>
+ </renderer>
+
+ <renderer>
<description><![CDATA[<div
class="changed_added_2_0">
<p>Render the markup for a <code><body></code>
element.</p>
Index: jsf-api/doc/web-facesview_2_1.xsd
===================================================================
--- jsf-api/doc/web-facesview_2_1.xsd (revision 0)
+++ jsf-api/doc/web-facesview_2_1.xsd (revision 0)
@@ -0,0 +1,129 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+
+
+<xsd:schema
+
targetNamespace="http://java.sun.com/xml/ns/javaee"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="2.1">
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the
+ GNU General Public License Version 2 only ("GPL") or the Common
+ Development and Distribution License("CDDL") (collectively, the
+ "License"). You may not use this file except in compliance with
+ the License. You can obtain a copy of the License at
+
https://glassfish.dev.java.net/public/CDDL+GPL.html or
+ glassfish/bootstrap/legal/LICENSE.txt. See the License for the
+ specific language governing permissions and limitations under the
+ License.
+
+ When distributing the software, include this License Header
+ Notice in each file and include the License file at
+ glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
+ particular file as subject to the "Classpath" exception as
+ provided by Sun in the GPL Version 2 section of the License file
+ that accompanied this code. If applicable, add the following
+ below the License Header, with the fields enclosed by brackets []
+ replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the
+ CDDL or only the GPL Version 2, indicate your decision by adding
+ "[Contributor] elects to include this software in this
+ distribution under the [CDDL or GPL Version 2] license." If you
+ don't indicate a single choice of license, a recipient has the
+ option to distribute your version of this file under either the
+ CDDL, the GPL Version 2 or to extend the choice of license to its
+ licensees as provided above. However, if you add GPL Version 2
+ code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such
+ option by the copyright holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ The XML Schema for the JavaServer Faces XML Views (Version 2.1).
+
+ All JavaServer Faces XML Views must indicate
+ the JavaServer Faces XML View schema by indicating the JavaServer
+ Faces namespace:
+
+
http://java.sun.com/xml/ns/javaee
+
+ and by indicating the version of the schema by
+ using the version element as shown below:
+
+ <faces-view
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="2.1">
+ ...
+ </faces-view>
+
+ The instance documents may indicate the published
+ version of the schema using xsi:schemaLocation attribute
+ for javaee namespace with the following location:
+
+
http://java.sun.com/xml/ns/javaee/web-facesview_2_1.xsd
+
+ ]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="javaee_5.xsd"/>
+
+ <!-- **************************************************** -->
+
+ <xsd:element name = "faces-view"
type="javaee:faces-viewType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The "faces-view" element is the root of the UIComponent
hierarchy,
+ and contains nested elements for all
+ of the other components.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ </xsd:element>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name = "faces-viewType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Extension element for faces-view. It may contain
+ implementation specific content.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:any namespace="##any"
+ processContents="lax"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+</xsd:schema>
Index: jsf-api/doc/standard-html-renderkit.xml
===================================================================
--- jsf-api/doc/standard-html-renderkit.xml (revision 8552)
+++ jsf-api/doc/standard-html-renderkit.xml (working copy)
@@ -20021,6 +20021,44 @@
-->
<component>
<description>NONE</description>
+ <display-name>html</display-name>
+ <component-type>javax.faces.OutputHtml</component-type>
+ <component-class>javax.faces.component.html.Html</component-class>
+
+ <property>
+ <description>
+ Direction indication for text that does not inherit directionality.
+ Valid values are "LTR" (left-to-right) and "RTL"
(right-to-left).
+ </description>
+ <display-name>Direction</display-name>
+ <icon/>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <pass-through>true</pass-through>
+ </property-extension>
+ </property>
+ <property>
+ <description>
+ Code describing the language used in the generated markup
+ for this component.
+ </description>
+ <display-name>Language Code</display-name>
+ <icon/>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <pass-through>true</pass-through>
+ </property-extension>
+ </property>
+
+ <component-extension>
+ <base-component-type>javax.faces.Output</base-component-type>
+ <renderer-type>javax.faces.Html</renderer-type>
+ </component-extension>
+ </component>
+ <component>
+ <description>NONE</description>
<display-name>head</display-name>
<component-type>javax.faces.OutputHead</component-type>
<component-class>javax.faces.component.html.HtmlHead</component-class>
@@ -20059,6 +20097,44 @@
</component>
<component>
<description>NONE</description>
+ <display-name>title</display-name>
+ <component-type>javax.faces.OutputTitle</component-type>
+ <component-class>javax.faces.component.html.HtmlTitle</component-class>
+
+ <property>
+ <description>
+ Direction indication for text that does not inherit directionality.
+ Valid values are "LTR" (left-to-right) and "RTL"
(right-to-left).
+ </description>
+ <display-name>Direction</display-name>
+ <icon/>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <pass-through>true</pass-through>
+ </property-extension>
+ </property>
+ <property>
+ <description>
+ Code describing the language used in the generated markup
+ for this component.
+ </description>
+ <display-name>Language Code</display-name>
+ <icon/>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <pass-through>true</pass-through>
+ </property-extension>
+ </property>
+
+ <component-extension>
+ <base-component-type>javax.faces.Output</base-component-type>
+ <renderer-type>javax.faces.Title</renderer-type>
+ </component-extension>
+ </component>
+ <component>
+ <description>NONE</description>
<display-name>body</display-name>
<component-type>javax.faces.OutputBody</component-type>
<component-class>javax.faces.component.html.HtmlBody</component-class>
@@ -30938,6 +31014,94 @@
</renderer-extension>
</renderer>
<renderer>
+ <description><![CDATA[<div class="changed_added_2_1">
+
+<p><span class="changed_modified_2_1">Render</span> the
markup for
+a <code><html></code> element.</p>
+
+ <p>Decode Behavior</p>
+
+ <ul>
+
+<p>No action is required during decode for this renderer.</p>
+
+</ul>
+
+ <p>Encode Behavior</p>
+
+ <ul>
+
+<p>Render the starting <code><html></code> element tag.
Any
+attributes declared on the element must be passed through unmodified to
+the rendered output. At some
+point before rendering the closing <code></html></code>
element
+tag, render any resources that have been targeted for this "html"
+element:
+ <ul>
+ <li>Obtain a <code>UIViewRoot</code> instance.</li>
+ <li>Obtain a <code>List</code> of component resources targeted
for
+ this "html" element with a call to
<code>UIViewRoot.getComponentResources()</code>
+ with the <code>String "html"</code> as the
argument.</li>
+ <li>Iterate over the returned <code>List</code> of
<code>UIComponent</code> instances
+ and call <code>encodeAll</code> on each
<code>UIComponent</code> instance.
+
+<p>Any attributes declared on the element must be passed through
+unmodified to the rendered output.</p>
+
+ </ul>
+
+ <p>Note that due to the cascading nature of CSS files, the order
+ in which these files have been added to the view must be preserved
+ when rendering the references to the files within the
+ <code><head></code> element. Also, the end result of
the
+ rendered <code><head></code> section must be that any
CSS
+ files referenced due to previous calls to
+ <code>addComponentResource()</code> do not adversely interfere
+ with any CSS files manually placed in this section by the page
+ author.</p>
+
+ <p>Render the ending <code></html></code> element
tag.</p>
+
+</div>]]></description>
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>javax.faces.Html</renderer-type>
+ <renderer-class>
+ com.sun.faces.renderkit.html_basic.HtmlRenderer
+ </renderer-class>
+
+ <attribute>
+ <description>
+ Direction indication for text that does not inherit directionality.
+ Valid values are "LTR" (left-to-right) and "RTL"
(right-to-left).
+ </description>
+ <display-name>Direction</display-name>
+ <icon/>
+ <attribute-name>dir</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <attribute-extension>
+ <pass-through>true</pass-through>
+ </attribute-extension>
+ </attribute>
+ <attribute>
+ <description>
+ Code describing the language used in the generated markup
+ for this component.
+ </description>
+ <display-name>Language Code</display-name>
+ <icon/>
+ <attribute-name>lang</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <attribute-extension>
+ <pass-through>true</pass-through>
+ </attribute-extension>
+ </attribute>
+
+ <renderer-extension>
+ <jsp-ignore>true</jsp-ignore>
+ <tag-name>html</tag-name>
+ </renderer-extension>
+ </renderer>
+ <renderer>
<description><![CDATA[<div class="changed_added_2_0">
<p><span class="changed_modified_2_0_rev_a">Render</span> the
markup for
@@ -31030,6 +31194,71 @@
</renderer-extension>
</renderer>
<renderer>
+ <description><![CDATA[<div class="changed_added_2_1">
+
+<p><span class="changed_modified_2_0_rev_a">Render</span> the
markup for
+a <code><title></code> element.</p>
+
+ <p>Decode Behavior</p>
+
+ <ul>
+
+<p>No action is required during decode for this renderer.</p>
+
+</ul>
+
+ <p>Encode Behavior</p>
+
+ <ul>
+
+<p>Render the starting <code><title></code> element tag.
Any
+attributes declared on the element must be passed through unmodified to
+the rendered output.</p>
+
+ <p>Render the ending <code></title></code> element
tag.</p>
+
+</div>
+
+</div>]]></description>
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>javax.faces.Title</renderer-type>
+ <renderer-class>
+ com.sun.faces.renderkit.html_basic.TitleRenderer
+ </renderer-class>
+
+ <attribute>
+ <description>
+ Direction indication for text that does not inherit directionality.
+ Valid values are "LTR" (left-to-right) and "RTL"
(right-to-left).
+ </description>
+ <display-name>Direction</display-name>
+ <icon/>
+ <attribute-name>dir</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <attribute-extension>
+ <pass-through>true</pass-through>
+ </attribute-extension>
+ </attribute>
+ <attribute>
+ <description>
+ Code describing the language used in the generated markup
+ for this component.
+ </description>
+ <display-name>Language Code</display-name>
+ <icon/>
+ <attribute-name>lang</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <attribute-extension>
+ <pass-through>true</pass-through>
+ </attribute-extension>
+ </attribute>
+
+ <renderer-extension>
+ <jsp-ignore>true</jsp-ignore>
+ <tag-name>title</tag-name>
+ </renderer-extension>
+ </renderer>
+ <renderer>
<description><![CDATA[<div class="changed_added_2_0">
<p>Render the markup for a <code><body></code>
element.</p>
Index: jsf-api/src/main/java/javax/faces/application/ViewHandler.java
===================================================================
--- jsf-api/src/main/java/javax/faces/application/ViewHandler.java (revision 8552)
+++ jsf-api/src/main/java/javax/faces/application/ViewHandler.java (working copy)
@@ -127,7 +127,7 @@
* <p>The value to use for the default extension if the webapp is using
* url extension mapping.</p>
*/
- public static final String DEFAULT_SUFFIX = ".xhtml .jsp";
+ public static final String DEFAULT_SUFFIX = ".xhtml .view.xml .jsp";
/**
* <p class="changed_added_2_0">Allow the web application to define
an
Index: jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/html/HtmlLibrary.java
===================================================================
--- jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/html/HtmlLibrary.java (revision
8552)
+++ jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/html/HtmlLibrary.java (working
copy)
@@ -92,6 +92,9 @@
this.addHtmlComponent("head", "javax.faces.Output",
"javax.faces.Head");
+ this.addHtmlComponent("html", "javax.faces.Output",
+ "javax.faces.Html");
+
this.addHtmlComponent("inputHidden",
"javax.faces.HtmlInputHidden",
"javax.faces.Hidden");
@@ -162,6 +165,10 @@
this.addHtmlComponent("selectOneRadio",
"javax.faces.HtmlSelectOneRadio",
"javax.faces.Radio");
+
+ this.addHtmlComponent("title", "javax.faces.Output",
+ "javax.faces.Title");
+
}
}
Index: jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java
===================================================================
--- jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java (revision 0)
+++ jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java (revision 0)
@@ -0,0 +1,75 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").
You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2005-2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.sun.faces.facelets.tag.xml;
+
+import com.sun.faces.facelets.tag.composite.*;
+import com.sun.faces.facelets.tag.AbstractTagLibrary;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: CompositeLibrary.java 8384 2010-05-17 14:59:38Z jdlee $
+ */
+public final class XmlLibrary extends AbstractTagLibrary {
+
+ public final static String Namespace =
"http://java.sun.com/xml/ns/javaee";
+
+ public final static XmlLibrary Instance = new XmlLibrary();
+
+ public XmlLibrary() {
+ super(Namespace);
+
+ this.addTagHandler("faces-view", NoOpHandler.class);
+ }
+}
Index: jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/NoOpHandler.java
===================================================================
--- jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/NoOpHandler.java (revision 0)
+++ jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/NoOpHandler.java (revision 0)
@@ -0,0 +1,78 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").
You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2005-2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.sun.faces.facelets.tag.xml;
+
+import com.sun.faces.facelets.tag.TagHandlerImpl;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagConfig;
+import java.io.IOException;
+
+public class NoOpHandler extends TagHandlerImpl {
+
+ public final static String Name = "faces-view";
+
+
+ public NoOpHandler(TagConfig config) {
+ super(config);
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+ this.nextHandler.apply(ctx, parent);
+ }
+
+}
Index: jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/TitleRenderer.java
===================================================================
--- jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/TitleRenderer.java (revision
0)
+++ jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/TitleRenderer.java (revision
0)
@@ -0,0 +1,91 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").
You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package com.sun.faces.renderkit.html_basic;
+
+import com.sun.faces.renderkit.RenderKitUtils;
+import com.sun.faces.renderkit.Attribute;
+import com.sun.faces.renderkit.AttributeManager;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+/**
+ * /**
+ * <p>This <code>Renderer</code> is responsible for rendering
+ * the standard HTML title element.</p>
+ */
+public class TitleRenderer extends Renderer {
+
+ private static final Attribute[] TITLE_ATTRIBUTES =
+ AttributeManager.getAttributes(AttributeManager.Key.OUTPUTTITLE);
+
+ @Override
+ public void decode(FacesContext context, UIComponent component) {
+ // no-op
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("title", component);
+ RenderKitUtils.renderPassThruAttributes(context,
+ writer,
+ component,
+ TITLE_ATTRIBUTES);
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ // no-op
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.endElement("title");
+ }
+
+
+}
Index: jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HtmlRenderer.java
===================================================================
--- jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HtmlRenderer.java (revision
0)
+++ jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HtmlRenderer.java (revision
0)
@@ -0,0 +1,106 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").
You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package com.sun.faces.renderkit.html_basic;
+
+import com.sun.faces.renderkit.RenderKitUtils;
+import com.sun.faces.renderkit.Attribute;
+import com.sun.faces.renderkit.AttributeManager;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+/**
+ * /**
+ * <p>This <code>Renderer</code> is responsible for rendering
+ * the standard HTML html element as well as rendering any resources
+ * that should be output before the <code>html</code> tag is
closed.</p>
+ */
+public class HtmlRenderer extends Renderer {
+
+ private static final Attribute[] HTML_ATTRIBUTES =
+ AttributeManager.getAttributes(AttributeManager.Key.OUTPUTHTML);
+
+ @Override
+ public void decode(FacesContext context, UIComponent component) {
+ // no-op
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("html", component);
+ RenderKitUtils.renderPassThruAttributes(context,
+ writer,
+ component,
+ HTML_ATTRIBUTES);
+ encodeHtmlResources(context);
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ // no-op
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.endElement("html");
+ }
+
+
+ // --------------------------------------------------------- Private Methods
+
+
+ private void encodeHtmlResources(FacesContext context)
+ throws IOException {
+
+ UIViewRoot viewRoot = context.getViewRoot();
+ for (UIComponent resource : viewRoot.getComponentResources(context,
"html")) {
+ resource.encodeAll(context);
+ }
+
+ }
+
+}
Index: jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java
===================================================================
--- jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java (revision
8552)
+++ jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java (working
copy)
@@ -37,7 +37,6 @@
package com.sun.faces.application;
import com.sun.faces.RIConstants;
-import com.sun.faces.application.ApplicationStateInfo;
import com.sun.faces.scripting.groovy.GroovyHelper;
import com.sun.faces.application.resource.ResourceCache;
import com.sun.faces.application.resource.ResourceManager;
@@ -74,6 +73,7 @@
import com.sun.faces.el.ELUtils;
import com.sun.faces.el.FacesCompositeELResolver;
import com.sun.faces.el.VariableResolverChainWrapper;
+import com.sun.faces.facelets.tag.xml.XmlLibrary;
import com.sun.faces.lifecycle.ELResolverInitPhaseListener;
import javax.el.CompositeELResolver;
@@ -728,6 +728,7 @@
c.addTagLibrary(new FunctionLibrary(DevTools.class,
"http://java.sun.com/mojarra/private/functions"));
}
c.addTagLibrary(new CompositeLibrary());
+ c.addTagLibrary(new XmlLibrary());
return c;
Index: jsf-ri/src/main/resources/com/sun/faces/standard-html-renderkit-impl.xml
===================================================================
--- jsf-ri/src/main/resources/com/sun/faces/standard-html-renderkit-impl.xml (revision
8552)
+++ jsf-ri/src/main/resources/com/sun/faces/standard-html-renderkit-impl.xml (working
copy)
@@ -89,9 +89,15 @@
<output-body-renderer-class>
com.sun.faces.renderkit.html_basic.BodyRenderer
</output-body-renderer-class>
+ <output-html-renderer-class>
+ com.sun.faces.renderkit.html_basic.HtmlRenderer
+ </output-html-renderer-class>
<output-head-renderer-class>
com.sun.faces.renderkit.html_basic.HeadRenderer
</output-head-renderer-class>
+ <output-title-renderer-class>
+ com.sun.faces.renderkit.html_basic.TitleRenderer
+ </output-title-renderer-class>
<output-script-renderer-class>
com.sun.faces.renderkit.html_basic.ScriptRenderer
</output-script-renderer-class>
Index: jsf-ri/systest/web/WEB-INF/web.xml.template
===================================================================
--- jsf-ri/systest/web/WEB-INF/web.xml.template (revision 8552)
+++ jsf-ri/systest/web/WEB-INF/web.xml.template (working copy)
@@ -51,7 +51,18 @@
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
+
<context-param>
+ <param-name>com.sun.faces.autoCompleteOffOnViewState</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.FACELETS_SUPPRESS_XML_DECLARATION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
<param-name>com.sun.faces.enableThreading</param-name>
<param-value>true</param-value>
</context-param>
@@ -91,7 +102,7 @@
<context-param>
<param-name>facelets.VIEW_MAPPINGS</param-name>
- <param-value>/resources/composite/*;*.xhtml</param-value>
+ <param-value>/resources/composite/*;*.xhtml;*.view.xml</param-value>
</context-param>
<context-param>
Index: jsf-ri/systest/web/view.xml/index.view.xml
===================================================================
--- jsf-ri/systest/web/view.xml/index.view.xml (revision 0)
+++ jsf-ri/systest/web/view.xml/index.view.xml (revision 0)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-view
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesview_2_1.xsd"
+ version="2.1"
+
xmlns:h="http://java.sun.com/jsf/html">
+
+ <h:html>
+
+ <h:head><h:title>Raw XML View</h:title></h:head>
+
+ <h:body>
+
+ <h:form>
+
+ <h:panelGrid column="2">
+
+ <h:outputText value="hello"></h:outputText>
+
+ <h:commandButton
value="reload"></h:commandButton>
+
+ </h:panelGrid>
+
+ </h:form>
+
+ </h:body>
+
+ </h:html>
+
+</faces-view>
+
+
SECTION: New Files
----------------------------
I have attached to the issue a prototype implementation that, when
applied to the Mojarra HEAD, will generate the preceding HTML.
--
| edburns(a)oracle.com | office: +1 407 458 0017
| homepage: |
http://ridingthecrest.com/
| 04 work days until JSF 2.1 Milestone 2