View Javadoc

1   /*
2    * This file was automatically generated by Apache Tiles Autotag.
3    */
4   package org.apache.tiles.jsp.taglib;
5   
6   import java.io.IOException;
7   
8   import javax.servlet.jsp.JspException;
9   import javax.servlet.jsp.tagext.SimpleTagSupport;
10  
11  import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
12  
13  /**
14   * <p>
15   * <strong>Import attribute(s) in specified context.</strong>
16   * </p>
17   * <p>
18   * Import attribute(s) to requested scope. Attribute name and scope are
19   * optional. If not specified, all attributes are imported in page scope. Once
20   * imported, an attribute can be used as any other beans from jsp contexts.
21   * </p>
22   */
23  public class ImportAttributeTag extends SimpleTagSupport {
24  
25      /**
26       * The template model.
27       */
28      private org.apache.tiles.template.ImportAttributeModel model = new org.apache.tiles.template.ImportAttributeModel();
29  
30      /**
31       * The name of the attribute to import. If it is
32       * <code>null</code>, all the attributes will be imported.
33       */
34      private java.lang.String name;
35  
36      /**
37       * The scope into which the attribute(s) will be imported. If
38       * <code>null</code>, the import will go in page scope.
39       */
40      private java.lang.String scope;
41  
42      /**
43       * The name of the attribute into which the attribute will be
44       * imported. To be used in conjunction to <code>name</code>. If
45       * <code>null</code>, the value of <code>name</code> will be used.
46       */
47      private java.lang.String toName;
48  
49      /**
50       * If <code>true</code>, if the attribute is not present, the
51       * problem will be ignored.
52       */
53      private boolean ignore;
54  
55      /**
56       * Getter for name property.
57       *
58       * @return
59       * The name of the attribute to import. If it is
60       * <code>null</code>, all the attributes will be imported.
61       */
62      public java.lang.String getName() {
63          return name;
64      }
65  
66      /**
67       * Setter for name property.
68       *
69       * @param name
70       * The name of the attribute to import. If it is
71       * <code>null</code>, all the attributes will be imported.
72       */
73      public void setName(java.lang.String name) {
74          this.name = name;
75      }
76  
77      /**
78       * Getter for scope property.
79       *
80       * @return
81       * The scope into which the attribute(s) will be imported. If
82       * <code>null</code>, the import will go in page scope.
83       */
84      public java.lang.String getScope() {
85          return scope;
86      }
87  
88      /**
89       * Setter for scope property.
90       *
91       * @param scope
92       * The scope into which the attribute(s) will be imported. If
93       * <code>null</code>, the import will go in page scope.
94       */
95      public void setScope(java.lang.String scope) {
96          this.scope = scope;
97      }
98  
99      /**
100      * Getter for toName property.
101      *
102      * @return
103      * The name of the attribute into which the attribute will be
104      * imported. To be used in conjunction to <code>name</code>. If
105      * <code>null</code>, the value of <code>name</code> will be used.
106      */
107     public java.lang.String getToName() {
108         return toName;
109     }
110 
111     /**
112      * Setter for toName property.
113      *
114      * @param toName
115      * The name of the attribute into which the attribute will be
116      * imported. To be used in conjunction to <code>name</code>. If
117      * <code>null</code>, the value of <code>name</code> will be used.
118      */
119     public void setToName(java.lang.String toName) {
120         this.toName = toName;
121     }
122 
123     /**
124      * Getter for ignore property.
125      *
126      * @return
127      * If <code>true</code>, if the attribute is not present, the
128      * problem will be ignored.
129      */
130     public boolean isIgnore() {
131         return ignore;
132     }
133 
134     /**
135      * Setter for ignore property.
136      *
137      * @param ignore
138      * If <code>true</code>, if the attribute is not present, the
139      * problem will be ignored.
140      */
141     public void setIgnore(boolean ignore) {
142         this.ignore = ignore;
143     }
144 
145     /** {@inheritDoc} */
146     @Override
147     public void doTag() throws JspException, IOException {
148         AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.jsp.autotag.JspAutotagRuntime();
149         if (runtime instanceof SimpleTagSupport) {
150             SimpleTagSupport tag = (SimpleTagSupport) runtime;
151             tag.setJspContext(getJspContext());
152             tag.setJspBody(getJspBody());
153             tag.setParent(getParent());
154             tag.doTag();
155         }
156         org.apache.tiles.request.Request request = runtime.createRequest();        
157         model.execute(
158             name,
159             scope,
160             toName,
161             ignore,
162             request
163         );
164     }
165 }