📄 topiclisttag.java
字号:
package org.jetic.web.techbbs;import java.sql.*;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;import org.jetic.util.Format;/** * Title: 华源技术论坛 * Description: * Copyright: Copyright (c) 2001 * Company: GBSOURCE * @author fainter * @version 1.0 */public class TopiclistTag extends BodyTagSupport { private Information info = new Information(); private Format format = new Format(); private ResultSet rs = null; private int boardID = 1; private int page = 1; private int Topiccount = info.getPagesize(); public int doStartTag() throws javax.servlet.jsp.JspException { try { Mssql conn = new Mssql(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); String sql="select ID,fdctitle,fdcwriter,fdcmark,fdiicon,fdiclick,fdire" + " from tbtopic where fdimain=" + boardID + " and fditopic=0 order by fdortime desc"; rs = conn.executeQuery(sql); if (rs.next()) { rs.absolute((page-1) * Topiccount+1); pageContext.setAttribute("topicID", new Integer(rs.getInt("ID"))); pageContext.setAttribute("topictitle", new String(format.toHtml(rs.getString("fdctitle")))); pageContext.setAttribute("topicwriter", new String(rs.getString("fdcwriter"))); pageContext.setAttribute("topicmark", new String(rs.getString("fdcmark"))); pageContext.setAttribute("topicicon", new Integer(rs.getInt("fdiicon"))); pageContext.setAttribute("topicclick", new Integer(rs.getInt("fdiclick"))); pageContext.setAttribute("topicre", new Integer(rs.getInt("fdire"))); 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() && ((Topiccount--) > 1)) { pageContext.setAttribute("topicID", new Integer(rs.getInt("ID"))); pageContext.setAttribute("topictitle", new String(format.toHtml(rs.getString("fdctitle")))); pageContext.setAttribute("topicwriter", new String(rs.getString("fdcwriter"))); pageContext.setAttribute("topicmark", new String(rs.getString("fdcmark"))); pageContext.setAttribute("topicicon", new Integer(rs.getInt("fdiicon"))); pageContext.setAttribute("topicclick", new Integer(rs.getInt("fdiclick"))); pageContext.setAttribute("topicre", new Integer(rs.getInt("fdire"))); return EVAL_BODY_TAG; } else { body.writeOut(body.getEnclosingWriter()); return SKIP_BODY; } } catch (Exception ex) { ex.printStackTrace(System.err); return SKIP_BODY; } } public void setboardID(int newboardID) { boardID = newboardID; } public int getboardID() { return boardID; } public void setPage(int newPage) { page = newPage; } public int getPage() { return page; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -