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

📄 documenttag.java

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

import javax.servlet.jsp.tagext.*;
import cn.js.fan.db.ResultRecord;
import org.apache.log4j.Logger;
import cn.js.fan.db.ResultIterator;
import cn.js.fan.util.StrUtil;
import cn.js.fan.web.SkinUtil;

public class DocumentTag extends BodyTagSupport {
    int id = -1;
    String dirCode = "";

    Logger logger = Logger.getLogger(DocumentTag.class.getName());

    public DocumentTag() {
    }

    public void setId(String strid) {
        this.id = Integer.parseInt(strid);
    }

    public void setDirCode(String d) {
        this.dirCode = d;
    }

    /**
     * put your documentation comment here
     * @return
     */
    public int doEndTag() {
        try {
            Document doc = null;

            if (id != -1) {
                doc = getDoc(id);
            } else if (!dirCode.equals("")) {
                Leaf leaf = new Leaf();
                leaf = leaf.getLeaf(dirCode);
                //logger.info("dirCode=" + dirCode);
                if (leaf != null && leaf.getType() == 1)
                    doc = getDoc(leaf.getDocID());
            }
            if (doc != null) {
                BodyContent bc = getBodyContent();
                String body = bc.getString();
                //logger.info("content=" + doc.getContent());
                body = body.replaceAll("\\$title", doc.getTitle());
                body = body.replaceAll("\\$id", "" + doc.getID());
                body = body.replaceAll("\\$modifiedDate", cn.js.fan.util.DateUtil.format(doc.getModifiedDate(), "yy-MM-dd"));
                body = body.replaceAll("\\$summary", doc.getSummary());
                body = body.replaceAll("\\$content", doc.getContent(1));
                body = body.replaceAll("\\$dirCode", doc.getDirCode());
                   body = body.replaceAll("\\@dirCode", StrUtil.UrlEncode(doc.getDirCode()));
                pageContext.getOut().print(body);
            } else {
                pageContext.getOut().print("Document not found!");
            }
        } catch (Exception e) {
            logger.error(e.getMessage());
        }
        return EVAL_PAGE;
    }

    public Document getDoc(int id) {
        DocumentMgr docmgr = new DocumentMgr();
        Document doc = docmgr.getDocument(id);
        return doc;
    }

}

⌨️ 快捷键说明

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