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

📄 searchtag.java

📁 JAVA+JSP程序系统-华源网络科技论坛
💻 JAVA
字号:
package org.jetic.web.techbbs;import java.sql.*;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;import org.jetic.util.Format;import java.text.SimpleDateFormat;/** * Title:        华源技术论坛 * Description: * Copyright:    Copyright (c) 2001 * Company:      GBSOURCE * @author fainter * @version 1.0 */public class SearchTag extends BodyTagSupport {    private Information info = new Information();    private Format format = new Format();    private ResultSet rs = null;    private String title="";    private String writer="";    private String content="";    private int Topiccount = info.getPagesize();    private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");    public int doStartTag() throws javax.servlet.jsp.JspException {        try {            Mssql conn = new Mssql();            String sql="select id,fditopic,fdimain,fdiicon,fdctitle,fdcwriter,fdtime"                       + " from tbtopic where fdctitle like '%" + format.toSql(title)                       + "%' and fdcwriter like '%" + format.toSql(writer)                       + "%' and fdcmemo like '%" + format.toSql(content) + "%'";           rs = conn.executeQuery(sql);            if (rs.next()) {                pageContext.setAttribute("articleID", new Integer(rs.getInt("ID")));                pageContext.setAttribute("topic", new Integer(rs.getInt("fditopic")));                pageContext.setAttribute("boardID", new Integer(rs.getInt("fdimain")));                pageContext.setAttribute("icon", new Integer(rs.getInt("fdiicon")));                pageContext.setAttribute("title", new String(format.toHtml(rs.getString("fdctitle"))));                pageContext.setAttribute("writer", new String(rs.getString("fdcwriter")));                pageContext.setAttribute("time", new String(formatter.format(rs.getTimestamp("fdtime"))));                return EVAL_BODY_TAG;            }            else {                return SKIP_BODY;            }        }        catch (Exception ex) {             ex.printStackTrace(System.err);            return SKIP_BODY;        }    }    public int doAfterBody() throws javax.servlet.jsp.JspException {        BodyContent body = getBodyContent();        try {            if (rs.next()) {                pageContext.setAttribute("articleID", new Integer(rs.getInt("ID")));                pageContext.setAttribute("topic", new Integer(rs.getInt("fditopic")));                pageContext.setAttribute("boardID", new Integer(rs.getInt("fdimain")));                pageContext.setAttribute("icon", new Integer(rs.getInt("fdiicon")));                pageContext.setAttribute("title", new String(format.toHtml(rs.getString("fdctitle"))));                pageContext.setAttribute("writer", new String(rs.getString("fdcwriter")));                pageContext.setAttribute("time", new String(formatter.format(rs.getTimestamp("fdtime"))));                 return EVAL_BODY_TAG;            }            else {                body.writeOut(body.getEnclosingWriter());                return SKIP_BODY;            }        }        catch (Exception ex) {            ex.printStackTrace(System.err);            return SKIP_BODY;        }    }    public void settitle(String newtitle) {        title = newtitle;    }    public String gettitle() {        return title;    }    public void setwriter(String newwriter) {        writer = newwriter;    }    public String getwriter() {        return writer;    }    public void setcontent(String newcontent) {        content = newcontent;    }    public String getcontent() {        return content;    }}

⌨️ 快捷键说明

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