⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paramtag.java

📁 大家好啊 快来抢购J2ME东东 挺不错的啊 不要后悔啊 抓住机会
💻 JAVA
字号:
package com.ora.jsp.tags.generic;

import java.net.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

/**
 * This class is a custom action intended to be used in the body of
 * an EncodeURLTag or a RedirectTag. It adds the specified parameter
 * name and value to it's parent's list of parameters. It can be
 * used in the body of any tag handler that implements the ParamParent
 * interface.
 *
 * @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
 * @version 1.0
 */
public class ParamTag extends TagSupport {
    private String name;
    private String value;

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

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

    /**
     * Adds the parameter name and the URL encoded value to the
     * parent's parameter list.
     */
    public int doEndTag() throws JspException {
        Tag parent = findAncestorWithClass(this, ParamParent.class);
        if (parent == null) {
            throw new JspException("The param action is not " +
                "enclosed by a supported action type");
        }
        ParamParent paramParent = (ParamParent) parent;
        paramParent.setParam(name, URLEncoder.encode(value));
        return EVAL_PAGE;
    }
    
    /**
     * Releases all instance variables.
     */
    public void release() {
        name = null;
        value = null;
        super.release();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -