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

📄 contentservlet.java

📁 简易java框架开源论坛系统源码easyjf_bbs0.1.rar
💻 JAVA
字号:
package servlet;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import conn.*;
import bean.*;
import face.*;
import java.util.List;
import java.util.Iterator;
import util.Constants;

public class ContentServlet extends HttpServlet
{
	public void init(ServletConfig config) throws ServletException
	{
		super.init(config);
	}

	public void service(ServletRequest request, ServletResponse respone) throws ServletException,IOException
	{
		request.setCharacterEncoding("gb2312");
		String titleId = request.getParameter("titleId");
		PrintStream out = new PrintStream(respone.getOutputStream());
		try
		{
			FlashDbDao dd = FlashDbDao.instance(Constants.driver,
			Constants.url,Constants.username,Constants.password);
			String sql = "select tiezi_id,tiezi_type,ed.edition_title,tiezi_title,tiezi_content,user_name,tiezi_count from bbs_tiezi ti, bbs_edition ed where ti.edition_id = ed.edition_id and tiezi_id='" + titleId + "'";
			dd.setPstmt(sql);
			int count;
			ContentBean cb = new ContentBean();
			dd.setResultBean(cb);
			out.print("&id=" + cb.getId());
			out.print("&types=" + cb.getType());
			out.print("&edition=" + cb.getEdition());
			out.print("&titles=" + cb.getTitle());
			out.print("&contentArea=" + cb.getContent());
			out.print("&autuserhor=" + cb.getUser());
			count = Integer.parseInt(cb.getCount()) + 1;
			out.print("&count=" + count);
			sql = "update bbs_tiezi set tiezi_count = " + count + " where tiezi_id = " + titleId;
			dd.setPstmt(sql);
			dd.update();
			sql = "select revert_title, revert_content, user_name from bbs_revert where tiezi_id = " + titleId;
			dd.setPstmt(sql);
			RevertBean rb = new RevertBean();
			List ls = dd.getList(rb);
			String temp = "<table border='1' width='400' cellspacing='0' cellpadding='0' id='table1'>";
			for(Iterator it = ls.iterator(); it.hasNext(); )
			{
				rb = (RevertBean)it.next();
				temp += "<tr><td>标题:" + rb.getTitle() + "</td><br><td>内容:" + rb.getContent() + "</td><br>";
				temp += "<td>回复者:" + rb.getAuthor() + "</td></tr><br>";
				temp += "---------------------------------------------------------------------<br>";
			}
			temp += "</table>";
			out.print("&revertArea=" + temp);
		}
		catch (Exception e)
		{
			System.out.println("content的数据异常!");
		}
	}
}

⌨️ 快捷键说明

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