📄 showcard.java
字号:
package control;
import java.io.IOException;
import javax.servlet.http.*;
import javax.servlet.*;
import model.*;
import java.util.*;
/**
* 显示单个帖子(包括该帖子的所有回复)
* @author steven
*
*/
public class ShowCard extends HttpServlet
{
public void init(ServletConfig config)throws ServletException
{
super.init(config);
}
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
doPost(req,res);
}
public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
req.setCharacterEncoding("gbk");
int CardID = Integer.parseInt(req.getParameter("id"));
CardCom com = new CardCom("jdbc:mysql://localhost/mybbs","root", "root123");
HuiFuCom com2 = new HuiFuCom("jdbc:mysql://localhost/mybbs","root", "root123");
Card card= com.getCard(CardID);
Vector allhuifu = com2.getAllHuiFu(CardID);
req.setAttribute("card", card);
req.setAttribute("id", String.valueOf(CardID));
req.setAttribute("Keyword", card.getKeyword());
req.setAttribute("allhuifu", allhuifu);
tiaoZhuan(req,res,"/ShowCard.jsp");
}
public void tiaoZhuan(HttpServletRequest req,HttpServletResponse res,String page)throws ServletException,IOException
{
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(page);
dispatcher.forward(req, res);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -