1 | |
package org.seasar.cubby.tags; |
2 | |
|
3 | |
import java.util.HashMap; |
4 | |
import java.util.Map; |
5 | |
|
6 | |
import javax.servlet.http.HttpServletRequest; |
7 | |
import javax.servlet.jsp.JspException; |
8 | |
import javax.servlet.jsp.PageContext; |
9 | |
import javax.servlet.jsp.tagext.DynamicAttributes; |
10 | |
import javax.servlet.jsp.tagext.SimpleTagSupport; |
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | 31 | abstract public class DynamicAttributesTagSupport extends SimpleTagSupport |
18 | |
implements DynamicAttributes { |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | 31 | private Map<String, Object> attrs = new HashMap<String, Object>(); |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public void setDynamicAttribute(final String uri, final String localName, |
30 | |
final Object value) throws JspException { |
31 | 57 | this.attrs.put(localName, value); |
32 | 57 | } |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
protected Map<String, Object> getDynamicAttribute() { |
40 | 107 | return this.attrs; |
41 | |
} |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
protected PageContext getPageContext() { |
49 | |
return (PageContext) getJspContext(); |
50 | |
} |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
protected HttpServletRequest getRequest() { |
58 | |
return (HttpServletRequest) getPageContext().getRequest(); |
59 | |
} |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
protected static String toString(Object object) { |
69 | 80 | return object == null ? "" : object.toString(); |
70 | |
} |
71 | |
|
72 | |
} |