KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > views > velocity > BodyTagDirective


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.webwork.views.velocity;
6
7 import org.apache.velocity.context.InternalContextAdapter;
8 import org.apache.velocity.exception.MethodInvocationException;
9 import org.apache.velocity.exception.ParseErrorException;
10 import org.apache.velocity.runtime.parser.node.Node;
11
12 import java.util.HashMap JavaDoc;
13 import java.util.Map JavaDoc;
14
15
16 /**
17  * User: matt
18  * Date: May 28, 2003
19  * Time: 12:54:46 PM
20  *
21  * @deprecated Automatic JSP tag support doesn't work well and is likely to break. Please use the native Velocity
22  * tags introduced in WebWork 2.2
23  */

24 public class BodyTagDirective extends AbstractTagDirective {
25     public String JavaDoc getName() {
26         return "bodytag";
27     }
28
29     public int getType() {
30         return BLOCK;
31     }
32
33     /**
34      * for BLOCK directives, the last element in the Node is the body, so we want to make sure not to include this in
35      * the propertyMap that we're generating.
36      *
37      * @param node the node passed in to the render method
38      * @return a map of the user specified properties
39      * @throws org.apache.velocity.exception.ParseErrorException
40      * if a property was improperly formatted
41      * @see #render
42      * @see com.opensymphony.webwork.views.velocity.AbstractTagDirective#createPropertyMap
43      */

44     protected Map JavaDoc createPropertyMap(InternalContextAdapter contextAdapter, Node node) throws ParseErrorException, MethodInvocationException {
45         Map JavaDoc propertyMap = new HashMap JavaDoc();
46
47         for (int index = 1, length = node.jjtGetNumChildren() - 1;
48              index < length; index++) {
49             this.putProperty(propertyMap, contextAdapter, node.jjtGetChild(index));
50         }
51
52         return propertyMap;
53     }
54 }
55
Popular Tags