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

📄 stringtag.java

📁 java版源代码,里面包含很多源代码,大家可以看看.
💻 JAVA
字号:
package com.trulytech.mantis.tag;

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

/**
 *
 * <p>Title: Mantis</p>
 *
 * <p>Description: 获得request中String变量的标签</p>
 *
 * <p>Copyright: Copyright (c) 2002</p>
 *
 * <p>Company: </p>
 *
 * @author Wang Xian
 * @version 1.0
 */
/*例如************************************
 <bean:write name="Result" type="html" />
 <bean:write name="Result" />
 *******************************************/

public class StringTag
    extends TagSupport {

  private String Key = null;
  //输出格式
  private String Type = "";
  /**
   * 覆盖doStartTag方法
   * @return int
   * @throws JspTagException
   */
  public int doStartTag() throws JspTagException {
    return EVAL_BODY_INCLUDE;
  }

  public int doEndTag() throws JspTagException {
    try {
      if (this.pageContext.findAttribute(Key) != null)

        if (this.pageContext.findAttribute(Key) instanceof String)
          if (Type.equalsIgnoreCase("html"))
            this.pageContext.getOut().write(com.trulytech.mantis.system.
                                            Properties.HTMLEncoder( (String)this.
                pageContext.findAttribute(Key)));
          else
            this.pageContext.getOut().write( (String)this.pageContext.
                                            findAttribute(Key));
        else
          this.pageContext.getOut().write("");
      else
        this.pageContext.getOut().write("");

    }
    catch (IOException e) {
      throw new JspTagException("Fatal error");
    }
    return EVAL_PAGE;
  }

  public void setName(String Name) {
    this.Key = Name;
  }

  public void setType(String Type) {
    if (Type == null)
      this.Type = "";
    else
      this.Type = Type;
  }
}

⌨️ 快捷键说明

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