首页 > 其他 > 详细

编写处理请求参数的Servlet

时间:2017-11-09 23:54:56      阅读:310      评论:0      收藏:0      [点我收藏+]

 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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!