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

📄 basedatabodytagsupport.java

📁 这是一个mvc模式
💻 JAVA
字号:
package jsp.tags.dapact;

import javax.servlet.jsp.JspException;
import jsp.tags.dapact.conf.UserClassFactory;
import jsp.tags.dapact.lookup.*;
import jsp.tags.dapact.util.TagUtil;
/**
 * Title:        Data Aware Processing And Control Tags
 * Description:  Tag library for the processing and controlling the input and output of data.
 * Copyright:    LGPL (http://www.gnu.org/copyleft/lesser.html)
 * Compile Date: @compile_date@
 * @author Allen M Servedio
 * @amp_sign@version @VERSION@
 */

/**
 * Provides an implementation of the BodyTag interface and provides support for retrieving
 * data from other tags to populate properties.
 */
public class BaseDataBodyTagSupport extends BaseBodyTagSupport
{
  /**
   * Default constructor.
   */
  public BaseDataBodyTagSupport()
  {
  }

  /**
   * Called when the starting tag is found - sets the value attribute according to
   * lookup logic. It uses the lookupName attribute if it is set, otherwise it uses
   * the name attribute to lookup the value. The result will be set in the value attribute
   * (property) - unless it gets back a null, then the value property will remain unchanged.
   *
   * @return whatever the super class returns.
   */
  public int doStartTag() throws JspException
  {
    int result = super.doStartTag();
    BaseLookupValue lookup = UserClassFactory.getLookupValueInstance(getLookupValueName());

    // Get the lookup name... If it has a value, use it.
    String name = getLookupName();
    // Otherwise, use the control's name.
    if ((name == null) || (name.equals("")))
    {
      name = getName();
    }

    // Set the value from the looked up value.
    Object newVal = getNewValue();
    if (newVal instanceof String)
    {
      newVal = lookup.lookupValue(name, (String)newVal, this, pageContext);
    }
    else
    {
      newVal = lookup.lookupValue(name, newVal, this, pageContext);
    }
    if (newVal != null)
    {
      setNewValue(newVal);
    }

    return result;
  }

  /**
   * Called by the container to free the tags resources.
   */
  public void release()
  {
    super.release();
  }

  /*=============================================================================*/
  /*                           PROPERTIES/ATTRIBUTES                             */
  /*=============================================================================*/
  /**
   * A string constant that is used to retrieve and set the value of the data tag name property.
   */
  public static final String DATA_TAG_NAME_CONST = TagUtil.HIDE_ATTR_CHAR + "dataTagName";
  /**
   * Get comma separated data tag names that specify what data tags should be examined
   * and in what order.
   */
  public String getDataTagName()
  {
    return (String)getValue(DATA_TAG_NAME_CONST);
  }
  /**
   * Set comma separated data tag names that specify what data tags should be examined
   * and in what order.
   */
  public void setDataTagName(String dataTagName)
  {
    this.setValue(DATA_TAG_NAME_CONST, dataTagName);
  }

  /**
   * A string constant that is used to retrieve and set the new value of object.
   */
  public static final String NEW_VALUE_CONST = TagUtil.HIDE_ATTR_CHAR + "newValue";
  /**
   * Get the new value of the object.
   */
  public Object getNewValue()
  {
    return getValue(NEW_VALUE_CONST);
  }
  /**
   * Set the new value of the object.
   */
  public void setNewValue(Object newValue)
  {
    this.setValue(NEW_VALUE_CONST, newValue);
  }
}

⌨️ 快捷键说明

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