📄 70624c28fe09001c1ae389e389b64382
字号:
import bean.*;
import java.io.IOException;
import java.net.URLEncoder;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Class <b>RegisterController</b> contains
* the servlet controller functionality for processing
* customer login requests.
*
*
* @author ProjectGroup
* @version 1.0.0
*/
public class ChangInfoController extends Controller {
/**
* RegisterController doPost method. This is can be called
* by <b>Controller</b> superclass' doGet() method.
* @param req HttpServletRequest servlet request object
* @param res HttpServletResponse servlet response object
* @throws ServletException
* @throws IOException
*/
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
// Get the session object.
HttpSession session = req.getSession();
// Lets invalidate the session to get rid of the unnecessary objects.
//session.invalidate();
// Get a fresh HttpSession.
String fname = req.getParameter("fn");
String mname = req.getParameter("sn");
String lname = req.getParameter("ln");
String email=req.getParameter("em");
String country=req.getParameter("co");
String state=req.getParameter("st");
String city=req.getParameter("ci");
String liveadd = req.getParameter("la");
String passwd=req.getParameter("pw");
String postalcode=req.getParameter("pc");
String phonenum=req.getParameter("ph");
boolean r=false;
try {
Customer customer=(Customer)session.getAttribute("customer");
if(customer==null){
res.sendRedirect("/error/error.jsp");
}
else{
String num=customer.getNum();
r=StoreCustomer.updateCustomer(num,email,fname,mname,lname,country,state,city,liveadd,postalcode,phonenum,passwd);
if(r) {res.sendRedirect("/e-commerce/index.jsp");}
else res.sendRedirect("/e-commerce/error.jsp");
return;
} }catch (Exception e) {
sendErrorRedirect(req, res, e);
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -