📄 bookgood.java
字号:
package bookgood;
import java.sql.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import db.ConnOracle;
public class Bookgood extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
res.setContentType("text/html;charset=GBK");
req.setCharacterEncoding("GBK");
PrintWriter out = res.getWriter();
db.ConnOracle conn = new db.ConnOracle();
ResultSet rs = null;
HttpSession session = req.getSession();
int dept_id = Integer.parseInt(req.getParameter("id"));
//session.getAttribute("dept_id");
//int id =((Integer)session.getAttribute("dept_id")).intValue();
try{
String sql = "select * from table_good where dept_id ="+dept_id;//得到dept_id
rs = conn.query(sql);
session.setAttribute("dept_id",session.getAttribute("dept_id"));
req.setAttribute("applet",rs);
session.setAttribute("dept_id",req.getParameter("id"));
getServletConfig().getServletContext().getRequestDispatcher("/pages/bookgood.jsp").forward(req,res);
}catch(Exception e){
e.printStackTrace();
}
}
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
doGet(req,res);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -