View Javadoc

1   /*
2    * $Id: NestedWriteNestingTei.java 376843 2006-02-10 21:02:56Z husted $
3    *
4    * Copyright 1999-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.nested;
19  
20  import javax.servlet.jsp.tagext.TagData;
21  import javax.servlet.jsp.tagext.TagExtraInfo;
22  import javax.servlet.jsp.tagext.VariableInfo;
23  
24  /***
25   * NestedWriteNestingTei
26   *
27   * This class will allow the nested:writeNesting tag to actually do what the
28   * doc says and make a scripting variable as an option (when "id" is
29   * supplied).
30   *
31   * @version $Rev: 376843 $
32   * @since Struts 1.2
33   */
34  public class NestedWriteNestingTei extends TagExtraInfo {
35      /***
36       * Return information about the scripting variables to be created.
37       */
38      public VariableInfo[] getVariableInfo(TagData data) {
39          /* the id parameter */
40          String id = data.getAttributeString("id");
41  
42          VariableInfo[] vi = null;
43  
44          if (id != null) {
45              vi = new VariableInfo[1];
46              vi[0] =
47                  new VariableInfo(id, "java.lang.String", true,
48                      VariableInfo.AT_END);
49          } else {
50              vi = new VariableInfo[0];
51          }
52  
53          // job done
54          return vi;
55      }
56  }