KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > components > Label


1 package com.opensymphony.webwork.components;
2
3 import com.opensymphony.xwork.util.OgnlValueStack;
4
5 import javax.servlet.http.HttpServletRequest JavaDoc;
6 import javax.servlet.http.HttpServletResponse JavaDoc;
7
8 /**
9  * User: plightbo
10  * Date: Jul 20, 2005
11  * Time: 7:12:39 AM
12  */

13 public class Label extends UIBean {
14     final public static String JavaDoc TEMPLATE = "label";
15
16     protected String JavaDoc forAttr;
17
18     public Label(OgnlValueStack stack, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
19         super(stack, request, response);
20     }
21
22     protected String JavaDoc getDefaultTemplate() {
23         return TEMPLATE;
24     }
25
26     protected void evaluateExtraParams() {
27         super.evaluateExtraParams();
28
29         if (forAttr != null) {
30             addParameter("for", findString(forAttr));
31         }
32
33         // try value first, then name (this overrides the default behavior in the superclass)
34
if (value != null) {
35             addParameter("nameValue", findString(value));
36         } else if (name != null) {
37             String JavaDoc expr = name;
38             if (ALT_SYNTAX) {
39                 expr = "%{" + expr + "}";
40             }
41
42             addParameter("nameValue", findString(expr));
43         }
44     }
45
46     public void setFor(String JavaDoc forAttr) {
47         this.forAttr = forAttr;
48     }
49 }
50
Popular Tags