001: /*
002: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003: * @version $Id: ParamTag.java 6385 2007-10-25 14:02:26Z wehrens $
004: */
005: package org.gridsphere.provider.portletui.tags;
006:
007: import org.gridsphere.provider.portletui.beans.ParamBean;
008:
009: import javax.servlet.jsp.JspException;
010: import javax.servlet.jsp.JspTagException;
011: import javax.servlet.jsp.tagext.Tag;
012: import javax.servlet.jsp.tagext.TagSupport;
013:
014: /**
015: * The <code>ParamTag</code> is used to specify action paramters (name value pairs) inside of an
016: * <code>ActionLinkTag</code>, <code>RenderLinkTag</code> or an <code>ActionSubmitTag</code>, <code>RenderSubmitTag</code>
017: */
018: public class ParamTag extends TagSupport {
019:
020: protected String name = "";
021: protected String value = "";
022: protected ParamBean paramBean = null;
023: protected String beanId = "";
024:
025: /**
026: * Returns the bean identifier
027: *
028: * @return the bean identifier
029: */
030: public String getBeanId() {
031: return beanId;
032: }
033:
034: /**
035: * Sets the bean identifier
036: *
037: * @param beanId the bean identifier
038: */
039: public void setBeanId(String beanId) {
040: this .beanId = beanId;
041: }
042:
043: /**
044: * Sets the action parameter name
045: *
046: * @param name the action parameter name
047: */
048: public void setName(String name) {
049: this .name = name;
050: }
051:
052: /**
053: * Returns the action paramter name
054: *
055: * @return the action parameter name
056: */
057: public String getName() {
058: return name;
059: }
060:
061: /**
062: * Sets the action parameter value
063: *
064: * @param value the action paramter value
065: */
066: public void setValue(String value) {
067: this .value = value;
068: }
069:
070: /**
071: * Returns the action parameter value
072: *
073: * @return the action parameter value
074: */
075: public String getValue() {
076: return value;
077: }
078:
079: /**
080: * Sets the action parameter bean
081: *
082: * @param paramBean the action parameter bean
083: */
084: public void setParamBean(ParamBean paramBean) {
085: this .paramBean = paramBean;
086: }
087:
088: /**
089: * Returns the action parameter bean
090: *
091: * @return the action parameter bean
092: */
093: public ParamBean getParamBean() {
094: return paramBean;
095: }
096:
097: public int doStartTag() throws JspException {
098: Tag tag = getParent();
099: if (tag instanceof ActionTag) {
100: ActionTag actionTag = (ActionTag) tag;
101: paramBean = new ParamBean(name, value);
102: actionTag.addParamBean(paramBean);
103: }
104: return SKIP_BODY;
105: }
106:
107: public int doEndTag() throws JspTagException {
108: return EVAL_PAGE;
109: }
110:
111: }
|