/*
 * @author <a href="mailto:novotny@aei.mpg.de">Jason Novotny</a>
 * @version $Id$
 */
package org.gridlab.gridsphere.provider.portletui.tags;

import org.gridlab.gridsphere.provider.portletui.beans.ActionParamBean;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.tagext.Tag;

/**
 * The <code>ActionParamTag</code> is used to specify action paramters (name value pairs) inside of an
 * <code>ActionLinkTag</code> or an <code>ActionSubmitTag</code>
 */
public class ActionParamTag extends TagSupport {

    protected String name = "";
    protected String value = "";
    protected ActionParamBean paramBean = null;

    /**
     * Sets the action parameter name
     *
     * @param name the action parameter name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Returns the action paramter name
     *
     * @return the action parameter name
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the action parameter value
     *
     * @param value the action paramter value
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
     * Returns the action parameter value
     *
     * @return the action parameter value
     */
    public String getValue() {
        return value;
    }

    /**
     * Sets the action parameter bean
     *
     * @param paramBean the action parameter bean
     */
    public void setParamBean(ActionParamBean paramBean) {
        this.paramBean = paramBean;
    }

    /**
     * Returns the action parameter bean
     *
     * @return the action parameter bean
     */
    public ActionParamBean getParamBean() {
        return paramBean;
    }

    public int doStartTag() throws JspException {
        Tag tag =  getParent();
        if (tag instanceof ActionTag) {
            ActionTag actionTag = (ActionTag)tag;
            paramBean = new ActionParamBean(name, value);
            actionTag.addParamBean(paramBean);
        }
        return SKIP_BODY;
    }

    public int doEndTag() throws JspTagException {
        return EVAL_PAGE;
    }

}

@@ -713,16 +713,381 @@
  = null;
+%0A    protected String beanId = %22%22;%0A%0A    /**%0A     * Returns the bean identifier%0A     *%0A     * @return the bean identifier%0A     */%0A    public String getBeanId() %7B%0A        return beanId;%0A    %7D%0A%0A    /**%0A     * Sets the bean identifier%0A     *%0A     * @param beanId the bean identifier%0A     */%0A    public void setBeanId(String beanId) %7B%0A        this.beanId = beanId;%0A    %7D
 %0A%0A    /*

add setter/getter for beanId, caused error in weblogic server