View Javadoc

1   /*
2    * $Id: XhtmlTag.java 376841 2006-02-10 21:01:28Z husted $
3    *
4    * Copyright 2003,2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.struts.taglib.html;
19  
20  import org.apache.struts.Globals;
21  
22  import javax.servlet.jsp.JspException;
23  import javax.servlet.jsp.PageContext;
24  import javax.servlet.jsp.tagext.TagSupport;
25  
26  /***
27   * This tag tells all other html taglib tags to render themselves in xhtml. It
28   * has no attributes; it's presence in a page turns on xhtml. <p>
29   * Example:<br/> &lt;html:xhtml/&gt; </p>
30   */
31  public class XhtmlTag extends TagSupport {
32      /***
33       * Constructor for XhtmlTag.
34       */
35      public XhtmlTag() {
36          super();
37      }
38  
39      /***
40       * @see javax.servlet.jsp.tagext.Tag#doEndTag()
41       */
42      public int doEndTag() throws JspException {
43          this.pageContext.setAttribute(Globals.XHTML_KEY, "true",
44              PageContext.PAGE_SCOPE);
45  
46          return EVAL_PAGE;
47      }
48  }