KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > services > jsp > tags > HeadTag


1 package org.apache.turbine.services.jsp.tags;
2
3 /*
4  * Copyright 2001-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
19 import javax.servlet.jsp.JspException JavaDoc;
20 import javax.servlet.jsp.PageContext JavaDoc;
21 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
22
23 /**
24  * Supporting class for the head tag.
25  * Tags that surround the screen content that will replace the
26  * <x:screen section="head" /> tag in a layout template.
27  * Example usage:
28  * <x:head><title>Login</title></x:head>
29  *
30  * @author <a HREF="mailto:john.mcnally@clearink.com">John D. McNally</a>
31  * @version $Id: HeadTag.java,v 1.1.2.2 2004/05/20 03:03:07 seade Exp $
32  */

33 public class HeadTag extends TagSupport JavaDoc
34 {
35     /**
36      * Method called when the start tag is encountered. If the layout is
37      * in the head section, the contents between the head tags are executed.
38      * Otherwise they are skipped.
39      *
40      * @return EVAL_BODY_INCLUDE, if the section has been set to body
41      * or SKIP_BODY, if this section is not active.
42      */

43     public int doStartTag() throws JspException JavaDoc
44     {
45         boolean isActive = ScreenTag.HEAD.equals(
46             pageContext.getAttribute(ScreenTag.SECTION_KEY,
47                 PageContext.REQUEST_SCOPE) );
48         if (isActive)
49         {
50              return EVAL_BODY_INCLUDE;
51         }
52         return SKIP_BODY;
53     }
54     
55     /**
56      * Method called when the end tag is encountered; it does nothing.
57      *
58      * @return EVAL_PAGE
59      */

60     public int doEndTag() throws JspException JavaDoc
61     {
62         return EVAL_PAGE;
63     }
64 }
65
Popular Tags