1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor.tags;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 import javax.servlet.jsp.JspException;
27 import javax.servlet.jsp.tagext.DynamicAttributes;
28 import javax.servlet.jsp.tagext.Tag;
29 import javax.servlet.jsp.tagext.TagSupport;
30
31
32
33
34
35
36 public class ConfigTag extends TagSupport implements DynamicAttributes {
37
38 private Map<String, String> params = new HashMap<String, String>();
39
40 private static final long serialVersionUID = -5282810094404700422L;
41
42 @Override
43 public int doStartTag() throws JspException {
44
45 Tag ancestor = findAncestorWithClass(this, EditorTag.class);
46 if (ancestor == null)
47 throw new JspException(
48 "the config tag can only be nested within an editor tag");
49 EditorTag editorTag = (EditorTag) ancestor;
50 editorTag.setConfigParamAll(params);
51
52 return SKIP_BODY;
53 }
54
55 public void setDynamicAttribute(String arg0, String arg1, Object arg2)
56 throws JspException {
57 if (arg2 != null)
58 params.put(arg1, arg2.toString());
59 }
60
61 }