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

📄 notetag.java

📁 一个jsp写的bbs
💻 JAVA
字号:
package com.laoer.bbscs.web.taglib;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.apache.struts.taglib.TagUtils;
import com.laoer.bbscs.bean.Note;

/**
 * <p>Title: Tianyi BBS</p>
 *
 * <p>Description: BBSCS</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: Laoer.com</p>
 *
 * @author Gong Tianyi
 * @version 7.0
 */
public class NoteTag
    extends TagSupport {

  protected String name = "";

  protected String property = null;

  protected String scope = null;

  public NoteTag() {
  }

  public int doStartTag() throws JspException {
    return (SKIP_BODY);
  }

  public int doEndTag() throws JspException {
    //Note note;
    Object value = TagUtils.getInstance().lookup(pageContext, name, property, scope);
    if (value == null) {
      return (SKIP_BODY);
    }
    int isNew = ( (Integer) value).intValue();
    StringBuffer sb = new StringBuffer();
    if (isNew == 0) {
      sb.append("<img src=\"images/note_old.gif\" alt=\"\"/>");
    }

    if (isNew == 1) {
      sb.append("<img src=\"images/note_new.gif\" alt=\"\"/>");
    }
    //if (isNew == 2) {
      //sb.append("<img src=\"images/note_replied.gif\"/>");
    //}
    TagUtils.getInstance().write(pageContext, sb.toString());
    return (SKIP_BODY);

  }

  public String getName() {
    return name;
  }

  public String getProperty() {
    return property;
  }

  public String getScope() {
    return scope;
  }

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

  public void setProperty(String property) {
    this.property = property;
  }

  public void setScope(String scope) {
    this.scope = scope;
  }
}

⌨️ 快捷键说明

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