Use the <html:xhtml/> tag to render html tags in XHTML in included pages.

David

--- Samuli_Pöykkö <[EMAIL PROTECTED]> wrote:
> 
>       While developing a Struts application with the 1.1 RC2, I have 
> encountered a small problem. HTML elements miss out their XML-style end 
> tags when they are generated using tags from the taglib html in an 
> included page. Elements, that are generated in the same page as the 
> html:html tag with xhtml attribute set to true, do get their end tags 
> normally.
> 
>       After taking a glance of the source code for corresponding tags, I've 
> come to suspect that my problem could fixed with a change of two lines. 
> First, in the HtmlTag class, the value of the xhtml attribute is stored 
> in _page_ context. As objects of this scope are not visible in included 
> pages, I would change the store to be request scope. Correspondingly, 
> one would have to change the code of TagUtils which provides the 
> information about this attribute to other tags.
> 
>       Suggested changes are attached to this message as patches. I haven't 
> had the chace to test these changes in action, so it would be nice to 
> hear wether I am on a correct track at all. Maybe this problem should be
> 
> fixed some other way instead?
> 
> -- 
>          Samuli Pöykkö
> > Index: src/share/org/apache/struts/taglib/html/HtmlTag.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/taglib/html/HtmlTag.java,v
> retrieving revision 1.17
> diff -u -r1.17 HtmlTag.java
> --- src/share/org/apache/struts/taglib/html/HtmlTag.java      31 Jul 2003
> 00:19:04 -0000        1.17
> +++ src/share/org/apache/struts/taglib/html/HtmlTag.java      13 Aug 2003
> 10:48:07 -0000
> @@ -189,7 +189,7 @@
>              this.pageContext.setAttribute(
>                  Globals.XHTML_KEY,
>                  "true",
> -                PageContext.PAGE_SCOPE);
> +                PageContext.REQUEST_SCOPE);
>                  
>              sb.append(" xmlns=\"http://www.w3.org/1999/xhtml\"";);
>          }
> > Index: src/share/org/apache/struts/taglib/TagUtils.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
> retrieving revision 1.22
> diff -u -r1.22 TagUtils.java
> --- src/share/org/apache/struts/taglib/TagUtils.java  2 Aug 2003 22:19:37
> -0000 1.22
> +++ src/share/org/apache/struts/taglib/TagUtils.java  13 Aug 2003
> 10:48:40 -0000
> @@ -853,7 +853,7 @@
>          String xhtml =
>              (String) pageContext.getAttribute(
>                  Globals.XHTML_KEY,
> -                PageContext.PAGE_SCOPE);
> +                PageContext.REQUEST_SCOPE);
>  
>          return "true".equalsIgnoreCase(xhtml);
>      }
> 
> > ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to