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

📄 abstractdefineobjecttag.java

📁 基于struts框架的web开发应用实例
💻 JAVA
字号:
/**
 *
 * $Header: /raid1/wide/cvsroot/wide/dev/struts/struts-metadata/templates/new-app/nitroX-tour/site/WEB-INF/src/java/com/hp/mw/samples/struts/storefront/taglibs/AbstractDefineObjectTag.java,v 1.1 2005/10/10 20:12:04 sami Exp $
 *
 * Copyright (c) 2002 by M7 Corporation
 * All rights reserved.
 *
 * The information contained herein is confidential and proprietary
 * to M7 Corporation, and considered a trade secret as defined under
 * civil and criminal statutes.  M7 Corporation shall pursue its
 * civil and criminal remedies in the event of unauthorized use or
 * misappropriation of its trade secrets.  Use of this information
 * by anyone other than authorized employees of M7 Corporation is
 * granted only under a written non-disclosure agreement, expressly
 * prescribing the scope and manner of such use.
 *
 */
package com.hp.mw.samples.struts.storefront.taglibs;

import javax.servlet.jsp.*;


/**
 *
 * @author <a href="mailto:zcollier@m7.com">Zaitrarrio Collier</a>
 * @version $ Revision: $
 */
public abstract class AbstractDefineObjectTag
    extends AbstractTag
{
    //~ Instance fields --------------------------------------------------------

    protected String id;
    protected int    scope = PageContext.PAGE_SCOPE;

    //~ Constructors -----------------------------------------------------------

    protected AbstractDefineObjectTag( String id )
    {
        this.id = id;
    }

	protected AbstractDefineObjectTag( String id, int scope )
	{
		this.id = id;
		this.scope = scope;
	}

    protected AbstractDefineObjectTag(  ) {}

    //~ Methods ----------------------------------------------------------------

	/**
	 * @return
	 */
	public String getId() {
		return id;
	}

    /**
     * Set's the name of the page attribute that should be used to contain the object
     *
     * @param the name of the page attribute that should be used to contain the object
     */
    public void setId( String value )
    {
        this.id = value;
    }

	/**
	 * @return
	 */
	public int getScope() {
		return scope;
	}

	/**
	 * @param i
	 */
	public void setScope(int i) {
		scope = i;
	}

    protected abstract Object getObject(  )
        throws java.lang.Exception;

    /**
     * @see javax.servlet.jsp.tagext.Tag
     */
    public int doStartTag(  )
        throws JspException
    {
        try
        {
            Object object = getObject(  );
            if ( object != null )
            {
                pageContext.setAttribute( id, object, scope );
            }

            return ( SKIP_BODY );
        }
        catch ( java.lang.Exception e )
        {
            handlePageException( e );
            return ( SKIP_BODY );
        }
    }

}

⌨️ 快捷键说明

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