View Javadoc

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  abstract public class DynamicAttributesTagSupport extends SimpleTagSupport implements DynamicAttributes {
13  	
14  	@SuppressWarnings("unchecked")
15  	private Map<String, Object>  dyn = new HashMap<String, Object>();
16  	
17  	@SuppressWarnings("unchecked")
18  	public void setDynamicAttribute(final String uri, final String localName, final Object value)
19  	throws JspException {
20  		this.dyn.put(localName, value);
21  	}
22  	
23  	protected Map<String, Object> getDynamicAttribute() {
24  		return this.dyn;
25  	}
26  	
27  	protected String toString(Object object) {
28  		return object == null ? "" : object.toString();
29  	}
30  	
31  	protected PageContext getPageContext() {
32  		return (PageContext) getJspContext();
33  	}
34  
35  	protected HttpServletRequest getRequest() {
36  		return (HttpServletRequest) getPageContext().getRequest();
37  	}
38  
39  }