📄 deletefujian.java
字号:
package hunnu.edu.cn.product.servlet;
import hunnu.edu.cn.product.common.db.dao.TB_STORAGEDao;
import hunnu.edu.cn.product.common.db.dao.implement.DaoFactory;
import hunnu.edu.cn.product.common.db.pool.DBPoolManager;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DeleteFujian extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
DBPoolManager manager;
/**
* Constructor of the object.
*/
public DeleteFujian() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy();
manager.destroyPool();
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DaoFactory factory=DaoFactory.newInstance();
TB_STORAGEDao dao=factory.newTB_STORAGEDao();
Connection con= manager.getConnection();
int file_stg_id=0;
String sql="select file_stg_id from tb_storage t where file_stg_id=(select max(file_stg_id) from tb_storage)";
try {
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{file_stg_id=rs.getInt(1);}
} catch (SQLException e) {
e.printStackTrace();
}
int ids[]=new int[1];
ids[0]=file_stg_id;
dao.removes(ids);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
manager=new DBPoolManager();
manager.getPool().init();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -