package sun.hebtu;import java.io.IOException; import java.io.PrintWriter;import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;public class servletone extends HttpServlet {/*** Constructor of the object.*/public servletone() {super();}/*** Destruction of the servlet. */public void destroy() {super.destroy(); // Just puts "destroy" string in log// Put your code here}/*** The doGet method of the servlet. ** 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 {//现在我们希望doGet和doPost实现一样的功能,在doGet中调用doPost方法。doPost(request, response);}/*** The doPost method of the servlet. ** 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 {//进行字符编码及输出格式的设置request.setCharacterEncoding("utf-8");response.setContentType("text/html;charset=utf-8");PrintWriter out = response.getWriter();out.println("");out.println("");out.println(" ");out.println(" ");//得到表单中的每个值String name=request.getParameter("name");String email=request.getParameter("email");String age=request.getParameter("age");String time=request.getParameter("time"); String system1=request.getParameter("system");String language1=request.getParameter("language");String device=request.getParameter("device");//输出格式及内容out.println("姓名:"+name+" ");out.println("EMAIL:"+email+" ");out.println("年纪:"+age+" ");out.println("编程时间:"+time+" ");out.println("使用的操作系统:");String itemName[]=request.getParameterValues("system");if(itemName==null){out.println("");}else{for(int i=0;i");out.println("使用的编程语言:"); //String itemName2[]=request.getParameterValues("language");if(itemName2==null){out.println("");}else{for(int i=0;i");out.println(" ");out.println("");out.flush();out.close();}/*** Initialization of the servlet. ** @throws ServletException if an error occurs*/public void init() throws ServletException {// Put your code here}}