📄 shopadressselectbyid.java
字号:
package com.jxc.shopAdressServlet;
import java.io.IOException;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.jxc.dao.Conn;
import com.jxc.dao.DBConnection;
import com.jxc.dao.ShopAdressTreat;
import com.jxc.vo.ShopAdress;
import com.jxc.vo.Vo;
public class ShopAdressSelectById extends HttpServlet {
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String gid = request.getParameter("id");
String method = request.getParameter("method");
Vo shopa = new ShopAdress();
HttpSession session = request.getSession();
if (method.equals("update")) {
Connection conn = Conn.getConnection();
shopa = new ShopAdressTreat().selectById(conn, gid);
session.setAttribute("shopa", shopa);
response.sendRedirect("../shopAdress/ShopAdressUpdate.jsp");
}
else if (method.equals("selectbyid")) {
Connection conn=Conn.getConnection();
if (new ShopAdressTreat().selectId(conn, gid)) {
Connection conn1=Conn.getConnection();
shopa = new ShopAdressTreat().selectById(conn1, gid);
session.setAttribute("shopa", shopa);
response.sendRedirect("../shopAdress/ShopAdressSeleByctId.jsp");
} else {
session.setAttribute("erro", "false");
response.sendRedirect("../shopAdress/ShopAdressSeleByctId.jsp");
}
}
}
public void init() throws ServletException {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -