You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/11/19 03:38:41 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/form HtmlTag.java

craigmcc    00/11/18 18:38:40

  Modified:    src/doc  struts-form.xml
               src/share/org/apache/struts/taglib/form HtmlTag.java
  Log:
  Sigh ... the XHTML spec says use both "lang" and "xml:lang" but this would
  break HTML 4.01 DTD compliance.
  
  Now, there is an "xhtml" attribute on the <form:html> tag that you must
  set to true in order to generate the xml:lang attribute.
  
  Revision  Changes    Path
  1.10      +8 -0      jakarta-struts/src/doc/struts-form.xml
  
  Index: struts-form.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-form.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- struts-form.xml	2000/11/19 01:18:17	1.9
  +++ struts-form.xml	2000/11/19 02:38:40	1.10
  @@ -1154,6 +1154,7 @@
   	
   
           <tag>
  +
             <name>html</name>
             <summary>Render an HTML &lt;html&gt; Element</summary>
             <tagclass>org.apache.struts.taglib.form.HtmlTag</tagclass>
  @@ -1163,6 +1164,13 @@
             language attributes extracted from the user's current Locale
             object, if there is one.</p>
             </info>
  +
  +          <attribute>
  +            <name>xhtml</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +          </attribute>
  +
           </tag>
   
   
  
  
  
  1.2       +33 -5     jakarta-struts/src/share/org/apache/struts/taglib/form/HtmlTag.java
  
  Index: HtmlTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/HtmlTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlTag.java	2000/11/19 01:18:17	1.1
  +++ HtmlTag.java	2000/11/19 02:38:40	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/HtmlTag.java,v 1.1 2000/11/19 01:18:17 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/11/19 01:18:17 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/HtmlTag.java,v 1.2 2000/11/19 02:38:40 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/11/19 02:38:40 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * there is a current Locale available in the user's session.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/11/19 01:18:17 $
  + * @version $Revision: 1.2 $ $Date: 2000/11/19 02:38:40 $
    */
   
   public class HtmlTag extends TagSupport {
  @@ -88,7 +88,22 @@
       protected static MessageResources messages =
        MessageResources.getMessageResources(Constants.Package + ".LocalStrings");
   
  +
       /**
  +     * Are we rendering an xhtml page?
  +     */
  +    protected boolean xhtml = false;
  +
  +    public boolean getXhtml() {
  +        return (xhtml);
  +    }
  +
  +    public void setXhtml(boolean xhtml) {
  +        this.xhtml = xhtml;
  +    }
  +
  +
  +    /**
        * Process the start of this tag.
        *
        * @exception JspException if a JSP exception has occurred
  @@ -103,9 +118,12 @@
               if ((lang != null) && (lang.length() > 0)) {
                   sb.append(" lang=\"");
                   sb.append(lang);
  -                sb.append("\" xml:lang=\"");
  -                sb.append(lang);
                   sb.append("\"");
  +                if (xhtml) {
  +                    sb.append(" xml:lang=\"");
  +                    sb.append(lang);
  +                    sb.append("\"");
  +                }
               }
           }
           sb.append(">");
  @@ -119,6 +137,16 @@
                   (messages.getMessage("common.io", e.toString()));
           }
           return (SKIP_BODY);
  +
  +    }
  +
  +
  +    /**
  +     * Release any acquired resources.
  +     */
  +    public void release() {
  +
  +        xhtml = false;
   
       }