1 /*
2 * $Id: ELPutListTag.java 471754 2006-11-06 14:55:09Z husted $
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 package org.apache.strutsel.taglib.tiles;
22
23 import org.apache.struts.tiles.taglib.PutListTag;
24 import org.apache.strutsel.taglib.utils.EvalHelper;
25
26 import javax.servlet.jsp.JspException;
27
28 /**
29 * PutList tag implementation. <p> This class is a subclass of the class
30 * <code>org.apache.struts.taglib.tiles.PutListTag</code> which provides most
31 * of the described functionality. This subclass allows all attribute values
32 * to be specified as expressions utilizing the JavaServer Pages Standard
33 * Library expression language.
34 *
35 * @version $Rev: 471754 $
36 */
37 public class ELPutListTag extends PutListTag {
38 /**
39 * Instance variable mapped to "name" tag attribute. (Mapping set in
40 * associated BeanInfo class.)
41 */
42 private String nameExpr;
43
44 /**
45 * Getter method for "name" tag attribute. (Mapping set in associated
46 * BeanInfo class.)
47 */
48 public String getNameExpr() {
49 return (nameExpr);
50 }
51
52 /**
53 * Setter method for "name" tag attribute. (Mapping set in associated
54 * BeanInfo class.)
55 */
56 public void setNameExpr(String nameExpr) {
57 this.nameExpr = nameExpr;
58 }
59
60 /**
61 * Resets attribute values for tag reuse.
62 */
63 public void release() {
64 super.release();
65 setNameExpr(null);
66 }
67
68 /**
69 * Process the start tag.
70 *
71 * @throws JspException if a JSP exception has occurred
72 */
73 public int doStartTag() throws JspException {
74 evaluateExpressions();
75
76 return (super.doStartTag());
77 }
78
79 /**
80 * Processes all attribute values which use the JSTL expression evaluation
81 * engine to determine their values.
82 *
83 * @throws JspException if a JSP exception has occurred
84 */
85 private void evaluateExpressions()
86 throws JspException {
87 String string = null;
88
89 if ((string =
90 EvalHelper.evalString("name", getNameExpr(), this, pageContext)) != null) {
91 setName(string);
92 }
93 }
94 }