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

📄 conditionaltag.java

📁 招标投标网上系统
💻 JAVA
字号:
/*
 * $Id: ConditionalTag.java,v 1.2 2001/10/18 00:46:06 ro89390 Exp $
 * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
 */

package com.neusoft.taglibs.smart;

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

/**
 * A conditional tag.
 *
 * <waf:conditional id="id" scope="scope">
 *   <waf:true>blah</waf:true>
 *   <waf:false>blah</waf:false>
 * </waf:conditional>
 */
public class ConditionalTag
    extends TagSupport {

  boolean value;

  String id;
  String scope;

  public void setId(String i) {
    id = i;
  }

  public void setScope(String s) {
    scope = s;
  }

  public boolean getValue() {
    return value;
  }

  public int doStartTag() throws JspTagException {
    Object o = null;

    if (scope.equals("request")) {
      o = pageContext.getRequest().getAttribute(id);
    }
    else if (scope.equals("session")) {
      o = pageContext.getSession().getAttribute(id);
    }
    else if (scope.equals("page")) {
      o = pageContext.getAttribute(id);
    }

    value = doTest(o);

    return EVAL_BODY_INCLUDE;
  }

  protected boolean doTest(Object o) throws JspTagException {
    return false;
  }

  public int doEndTag() throws JspTagException {
    return EVAL_PAGE;
  }
}

⌨️ 快捷键说明

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