You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/02/23 20:09:20 UTC
svn commit: r155052 - in incubator/beehive/trunk/netui:
src/tags-html/org/apache/beehive/netui/tags/html/
src/tags-html/org/apache/beehive/netui/tags/rendering/
src/tags-template/org/apache/beehive/netui/tags/template/
test/webapps/drt/coreWeb/template/xhtml/
Author: dolander
Date: Wed Feb 23 11:09:18 2005
New Revision: 155052
URL: http://svn.apache.org/viewcvs?view=rev&rev=155052
Log:
Jira 273 -- Inside a template content page, you cannot set the documentType
The result is that a page may be a mix of XHTML and HTML. This will fix that
problem by allowing the content page to set the documentType overriding anything
set on the html tag in the template.
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Html.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Template.java
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/xhtml/Test.jsp
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java?view=diff&r1=155051&r2=155052
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java Wed Feb 23 11:09:18 2005
@@ -300,7 +300,6 @@
_popupSupport.addParams(this, request);
}
- ByRef ref = new ByRef();
if (_action != null) {
boolean isAction = PageFlowTagUtils.isAction(request, _action);
if (isAction) {
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Html.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Html.java?view=diff&r1=155051&r2=155052
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Html.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Html.java Wed Feb 23 11:09:18 2005
@@ -96,6 +96,11 @@
public static final String HTML_TAG_ID = "netui:html";
/**
+ * This is an override of the Document type set in the request
+ */
+ public static final String DOC_TYPE_OVERRIDE = "netui:doctype";
+
+ /**
* Constant representing the document type html 4.01
*/
public static final String HTML_401 = "html4-loose";
@@ -188,13 +193,6 @@
public void setUseLocale(boolean locale)
{
_useLocale = locale;
- }
-
- /**
- */
- public String getDocumentType()
- {
- return _docType;
}
/**
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java?view=diff&r1=155051&r2=155052
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java Wed Feb 23 11:09:18 2005
@@ -332,12 +332,17 @@
*/
public static TagRenderingBase getRendering(Object token, ServletRequest req)
{
- Html html = (Html) req.getAttribute(Html.HTML_TAG_ID);
-
- // the default is html 4.0
int renderingType = _defaultDocType;
- if (html != null) {
- renderingType = html.getTargetDocumentType();
+ Integer reqRender = (Integer) req.getAttribute(Html.DOC_TYPE_OVERRIDE);
+ if (reqRender != null) {
+ renderingType = ((Integer) reqRender).intValue();
+ }
+ else {
+ Html html = (Html) req.getAttribute(Html.HTML_TAG_ID);
+ // the default is html 4.0
+ if (html != null) {
+ renderingType = html.getTargetDocumentType();
+ }
}
// pick the map of renderers
Modified: incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Template.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Template.java?view=diff&r1=155051&r2=155052
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Template.java (original)
+++ incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Template.java Wed Feb 23 11:09:18 2005
@@ -20,6 +20,8 @@
import org.apache.beehive.netui.tags.AbstractClassicTag;
import org.apache.beehive.netui.tags.AbstractPageError;
import org.apache.beehive.netui.tags.IErrorReporter;
+import org.apache.beehive.netui.tags.html.Html;
+import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
import org.apache.beehive.netui.util.Bundle;
import org.apache.beehive.netui.util.logging.Logger;
@@ -169,6 +171,29 @@
*/
public void setTemplatePage(String templatePage) {
_templatePage = templatePage;
+ }
+
+ /**
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="Set the document type (html4-loose or xhtml1-transitional) of the document."
+ */
+ public void setDocumentType(String docType)
+ {
+ int rendering = 0;
+ if (docType != null) {
+ if (docType.equals(Html.HTML_401))
+ rendering = TagRenderingBase.HTML_RENDERING;
+ else if (docType.equals(Html.HTML_401_QUIRKS))
+ rendering = TagRenderingBase.HTML_RENDERING_QUIRKS;
+ else if (docType.equals(Html.XHTML_10))
+ rendering = TagRenderingBase.XHTML_RENDERING;
+ else
+ rendering = TagRenderingBase.getDefaultDocType();
+ }
+ else {
+ rendering = TagRenderingBase.getDefaultDocType();
+ }
+ pageContext.getRequest().setAttribute(Html.DOC_TYPE_OVERRIDE, new Integer(rendering));
}
/**
Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/xhtml/Test.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/xhtml/Test.jsp?view=diff&r1=155051&r2=155052
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/xhtml/Test.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/xhtml/Test.jsp Wed Feb 23 11:09:18 2005
@@ -1,7 +1,7 @@
<%@ page language="java"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="temp" %>
<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui" %>
-<temp:template templatePage="Template.jsp">
+<temp:template templatePage="Template.jsp" documentType="xhtml1-transitional">
<temp:setAttribute name="title" value="Simple Test"/>
<temp:section name="left">
<netui:form action="post">