⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 regservlet.java~56~

📁 一个java
💻 JAVA~56~
字号:
package bookstore.servlet;import bookstore.ejb.*;import bookstore.util.*;import javax.servlet.*;import javax.servlet.http.*;import java.io.*;import java.util.*;import java.sql.*;public class regServlet extends HttpServlet{  private static final String CONTENT_TYPE = "text/html; charset=GBK";  private EJBGetterSession ejbGetterSession;  private CustomerDetails customerValue;  private CustomerController customerController;  private CustomerControllerHome customerControllerHome;  //Initialize global variables  public void init() throws ServletException  {  }  //Process the HTTP Get request  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException  {  }  //Process the HTTP Post request  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException  {    String requestFrom=request.getParameter("requestFrom");    int year,month,day,sexual;    String temp;    java.sql.Date birthDay;    if(requestFrom.equals("register"))    {      try      {        ejbGetterSession=(EJBGetterSession)getServletContext().getAttribute("ejbGetterSession");        customerControllerHome=ejbGetterSession.getCustomerControllerHome();        customerController=customerControllerHome.create();        temp=request.getParameter("sexual");        if(temp=="男")           sexual=1;        else           sexual=0;        year=Integer.parseInt(request.getParameter("birth_year"));        month=Integer.parseInt(request.getParameter("birth_month"));        day=Integer.parseInt(request.getParameter("birth_day"));        birthDay=new java.sql.Date(DateHelper.getDate(year,month,day).getTime());        customerValue=new CustomerDetails ("", request.getParameter("name"),             request.getParameter("account"), request.getParameter("password"),             sexual, birthDay, request.getParameter("city"),             request.getParameter("profession"), request.getParameter("iDCardNum"),             request.getParameter("address"),request.getParameter("zip"),             request.getParameter("phone"), request.getParameter("eMail"),0);        customerController.createCustomer(customerValue);      }catch(Exception ex)          {           System.out.println(ex.getMessage());//要做成对话框提示异常内容          }    }  }  //Clean up resources  public void destroy() {  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -