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

📄 simpletexttag.java

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

import java.io.IOException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspException;
import jsp.tags.dapact.BaseDataTagSupport;
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@
 */

/**
 * Simple text tag that looks up its value and displays it.
 */
public class SimpleTextTag extends BaseDataTagSupport
{
  /**
   * Default constructor...
   */
  public SimpleTextTag()
  {
  }

  /**
   * Called when the starting tag is found - writes the new value unless it is null,
   * in which case it will look at the value attribute and print that if it is not null.
   *
   * @return EVAL_BODY_INCLUDE so that it processes what ever is in the body.
   */
  public int doStartTag() throws JspException
  {
    // The super class will lookup and set the new value in the new value property.
    super.doStartTag();
    try
    {
      String valAsStr = TagUtil.getStringFromObj(getNewValue());
      if (valAsStr != null)
      {
        setValue(valAsStr);
      }

      String data = getValue();
      if (data != null)
      {
        JspWriter out = pageContext.getOut();
        out.write(data);
      }
    }
    catch (IOException e)
    {
      throw new JspException("JspWriter not there: " + e);
    }
    return EVAL_BODY_INCLUDE;
  }

  /*=============================================================================*/
  /*                           PROPERTIES/ATTRIBUTES                             */
  /*=============================================================================*/
  /**
   * A string constant that is used to retrieve and set the value of the value property.
   */
  public static final String VALUE_CONST = "value";
  /**
   * Get the value of the object.
   */
  public String getValue()
  {
    return (String)getValue(VALUE_CONST);
  }
  /**
   * Set the value of the object.
   */
  public void setValue(String value)
  {
    this.setValue(VALUE_CONST, value);
  }
}

⌨️ 快捷键说明

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