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

📄 forumtopic.java

📁 BBS论坛设计JSP+MYSQL
💻 JAVA
字号:
package com.bcxy.bbs.forum;

/**
 * Title:
 * Description:
 * Copyright:
 * Company: www.liyunet.com
 * 
 * @author lishujiang	
 * @version 1.0
 */
import com.bcxy.bbs.filter.MyFilter;
import com.bcxy.bbs.util.StringUtils;
import com.bcxy.db.SqlQuery;

public class ForumTopic extends ForumMSG {

	String followMSG = "-----", followUser = "-------",
			followDateAndTime = "-------";

	public ForumTopic()
	{
		//super(announceID);	
	}
	/**
	 * 重写构造函数
	 *
	 */
	public ForumTopic(int forumRootID, int announceID) {
		super(announceID);
		//
		try {
			String sql = "select  username,dateandtime,topic,body from bbs1 where rootid="+forumRootID+" and announceid!="+forumRootID+" order by announceid desc";

			SqlQuery rs = new SqlQuery(sql);
			if (rs.next()) {
				followUser = rs.getString(1);
				followDateAndTime = rs.getString(2);
				String followTopic = rs.getString(3);
				if (followTopic != null && !"".equals(followTopic.trim()))
					followMSG = StringUtils.escapeHTMLTags(followTopic);
				else {
					if (rs.getString(4).length() > 24)
						followMSG = StringUtils.escapeHTMLTags(rs.getString(4)
								.substring(0, 24).replaceAll("\\r|\\n", "")
								.replaceAll(" ", " "));
					else
						followMSG = StringUtils.escapeHTMLTags(rs.getString(4)
								.replaceAll("\\r|\\n", "").replaceAll(" ",
										" "));
				}
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

	public ForumTopic(int forumRootID) {
		super();
		try {
			String sql = "select  username,dateandtime,topic,body from bbs1 where rootid="+forumRootID+" and announceid!="+forumRootID+" order by announceid desc";

			SqlQuery rs = new SqlQuery(sql);
			if (rs.next()) {
				followUser = rs.getString(1);
				followDateAndTime = rs.getString(2);
				String followTopic = rs.getString(3);
				if (followTopic != null && !"".equals(followTopic.trim()))
					followMSG = StringUtils.escapeHTMLTags(followTopic);
				else {
					if (rs.getString(4).length() > 24)
						followMSG = StringUtils.escapeHTMLTags(rs.getString(4)
								.substring(0, 24).replaceAll("\\r|\\n", "")
								.replaceAll(" ", " "));
					else
						followMSG = StringUtils.escapeHTMLTags(rs.getString(4)
								.replaceAll("\\r|\\n", "").replaceAll(" ",
										" "));
				}
			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public String getNoFilterTopic() {

		if (topic != null && !"".equals(topic.trim()))
			return StringUtils.replace(StringUtils.replace(StringUtils
					.convertNewlines(StringUtils.escapeHTMLTags(topic)), " ",
					"&nbsp;"), "<BR>", "");
		else {

			String tempString = "";
			if (body.length() > 24)
				tempString = body.substring(0, 24);
			else
				tempString = body;

			return StringUtils.replace(StringUtils.replace(
					StringUtils.escapeHTMLTags(tempString).replaceAll(
							"\\r|\\n", "&nbsp;"), " ", "&nbsp;"), "<BR>", "");

		}

	}

	public String getTopic() {

		if (topic != null && !("".equals(topic.trim())))
			return (new MyFilter(StringUtils.replace(StringUtils
					.convertNewlines(StringUtils.escapeHTMLTags(topic)), " ",
					"&nbsp;"))).getFilterString();
		else {
			if (body.length() > 24)
				return (new MyFilter(StringUtils.replace(StringUtils
						.convertNewlines(StringUtils.escapeHTMLTags(body
								.substring(0, 24))), " ", "&nbsp;")))
						.getFilterString();
			else
				return (new MyFilter(StringUtils.replace(StringUtils
						.convertNewlines(StringUtils.escapeHTMLTags(body)),
						" ", "&nbsp;"))).getFilterString();

		}

	}

	public String getFollowMSG() {

		return followMSG;
	}

	public String getFollowUser() {
		return followUser;
	}

	public String getFollowDateAndTime() {
		return followDateAndTime;
	}

}

⌨️ 快捷键说明

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