码迷,mamicode.com
首页 > 其他好文 > 详细

编写处理请求参数的Servlet

时间:2017-11-10 00:30:38      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:tco   iter   vax   throw   res   body   head   end   charset   

 packet servlet;

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

 

public class CheckParamServlet extends HttpServlet{

   public void doGet(HttpServletRequest request,

                      HttpServletResponse response)

        throws ServletException, IOException {

 

     String name = request.getParameter("name");

     String pass = request.getParameter("pass");

     response.setContentType("text/html;charset=gb2312");

     PrintWriter out = response.getWriter();

    

     out.println("<html><head><title>Param Test</title></head>");  

     out.println("<h3 align=center>你的用户名为:"+name+"</h3>");

     out.println("<h3 align=center>你的口令为:"+pass+"</h3>");

     out.println("</body></html>");         

   }

  

   public void doPost(HttpServletRequest request,

                      HttpServletResponse response)

        throws ServletException, IOException {

      

       doGet(request,response);

   }

}

编写处理请求参数的Servlet

标签:tco   iter   vax   throw   res   body   head   end   charset   

原文地址:http://www.cnblogs.com/lozjl/p/7811825.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!