📄 shopadressinsertservlet.java
字号:
package com.jxc.shopAdressServlet;
import java.io.IOException;
import java.sql.Connection;
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.DBConnection;
import com.jxc.dao.*;
import com.jxc.vo.ShopAdress;
public class ShopAdressInsertServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
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("gid");
String gpho = request.getParameter("gpho");
String gfac = request.getParameter("gfac");
String gname = request.getParameter("gname");
Connection conn = Conn.getConnection();
if ("".equals(gid) || "".equals(gname)) {
HttpSession session = request.getSession();
session.setAttribute("erro", "fal");
response.sendRedirect("../shopAdress/ShopAdressInsert.jsp");
} else {
ShopAdress shopa = new ShopAdress();
HttpSession session = request.getSession();
shopa.setGid(gid);
shopa.setGpho(gpho);
shopa.setGfac(gfac);
shopa.setGname(gname);
if (new ShopAdressTreat().insert(conn, shopa)) {
session.setAttribute("erro", "succ");
response.sendRedirect("../shopAdress/ShopAdressInsert.jsp");
}
}
}
public void init() throws ServletException {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -