KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > request > RequestTag


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.taglibs.request;
18
19 import javax.servlet.*;
20 import javax.servlet.http.*;
21 import javax.servlet.jsp.*;
22 import javax.servlet.jsp.tagext.*;
23
24 /**
25  * JSP Tag <b>request</b>, used to get HttpServletRequest information
26  * using the standard JSP &lt;jsp:getProperty&gt; tag.
27  * <p>
28  * The script variable of name <b>id</b> is available for use during
29  * processing of the entire JSP page.
30  * <p>
31  * JSP Tag Lib Descriptor
32  * <p><pre>
33  * &lt;name&gt;request&lt;/name&gt;
34  * &lt;tagclass&gt;org.apache.taglibs.request.RequestTag&lt;/tagclass&gt;
35  * &lt;teiclass&gt;org.apache.taglibs.request.RequestTEI&lt;/teiclass&gt;
36  * &lt;bodycontent&gt;empty&lt;/bodycontent&gt;
37  * &lt;info&gt;Get information about the current request.&lt;/info&gt;
38  * &lt;attribute&gt;
39  * &lt;name&gt;id&lt;/name&gt;
40  * &lt;required&gt;true&lt;/required&gt;
41  * &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
42  * &lt;/attribute&gt;
43  * </pre>
44  *
45  * @see RequestTEI
46  * @see RequestData
47  * @author Glenn Nielsen
48  */

49
50 public class RequestTag extends TagSupport
51 {
52
53     /**
54      * Method called at start of tag, gets HttpServletRequest.
55      *
56      * @return SKIP_BODY
57      */

58     public final int doStartTag() throws JspException
59     {
60     pageContext.setAttribute(id,
61         new RequestData((HttpServletRequest)pageContext.getRequest()),
62         PageContext.PAGE_SCOPE);
63     return SKIP_BODY;
64     }
65 }
66
Popular Tags