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

📄 navelementtag.java

📁 源码/软件简介: 云网论坛1.1RC国际版是采用JSP开发的集论坛、CMS(网站内容管理系统)、博客、聊天室、商城、交友、语音灌水等于一体的门户式社区。拥有CWBBS ( Cloud Web BBS
💻 JAVA
字号:
package cn.js.fan.module.nav;

import javax.servlet.jsp.tagext.*;
import org.apache.log4j.Logger;
import java.util.Iterator;
import cn.js.fan.util.StrUtil;

public class NavElementTag extends BodyTagSupport{
    Iterator ri;
    Logger logger = Logger.getLogger(NavElementTag.class.getName());

    /**
     * put your documentation comment here
     */
    public NavElementTag () {
        ri = null;
    }

    /**
     * put your documentation comment here
     * @return
     */
    public int doStartTag () {
        NavBarTag rit = (NavBarTag)this.findAncestorWithClass(this,NavBarTag.class);
        if (rit != null) {
            ri = rit.ir;
        }
        else {
            logger.error("get resultsets failed!");
        }
        return  EVAL_BODY_BUFFERED; // SKIP_BODY;
    }

    /**
     * put your documentation comment here
     * @return
     */
    public int doEndTag () {
        try {
            if (ri!=null) {
               Navigation nav = (Navigation) ri.next();
               BodyContent bc = getBodyContent();
               String body = bc.getString();
               String color = StrUtil.getNullString(nav.getColor());
               if (color.equals(""))
                   body = body.replaceAll("\\$name", nav.getName());
               else
                   body = body.replaceAll("\\$name", "<font color='" + color + "'>" + nav.getName() + "</font>");
               body = body.replaceAll("\\$link", nav.getLink());

               pageContext.getOut().print(body);
            }
        } catch (Exception e) {
            logger.error(e.getMessage());
        }
        return  EVAL_PAGE;
    }

}

⌨️ 快捷键说明

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