📄 forumservlet.java~4~
字号:
package gxaccp.t07.guoneng_wei.petclinicmanagesystem.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import gxaccp.t07.guoneng_wei.bbs.beans.*;
import gxaccp.t07.guoneng_wei.jdbc.*;
public class ForumServlet
extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init(ServletConfig scf) throws ServletException {
super.init(scf);
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
request.setCharacterEncoding("GBK");
doPost(request, response);
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
request.setCharacterEncoding("GBK");
String pageNum=request.getParameter("jumpPage");//接收请求的页号
try {
Connection con=(Connection) this.getServletContext().getAttribute("connection");
PageBean pb = new PageBean();
synchronized (con) {
if (pageNum != null && !pageNum.equals("")) { //如果有参数传来页面号
pb.setCurrentPage(Integer.parseInt(pageNum));//就将参数设置为当前页面号
System.out.println("111111111111111111111111111111111111");
}
pb.init(con);//初始化PageBean对象
}
request.setAttribute("PageBean",pb);//请求范围内的属性
}
catch (Exception ex) {
}
request.getRequestDispatcher("view.jsp").forward(request,response);
}
//Clean up resources
public void destroy() {
super.destroy();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -