我在前台使用window.location.href="XXservlet?count=1"方法调用后台的servlet
在后台的servlet中我用request.getParameter("count")方法得到的值是null
请问各位大侠可能是什么问题?谢谢啦URLServlet

解决方案 »

  1.   

    你检查下你servlet中是用doGet还是doPost获取的
    你上面的提交方式是get提交
    或者 你按我下面的代码:
    public void destroy() {
    super.destroy(); // Just puts "destroy" string in log
    }
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    this.doPost(request, response);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

    //下面写你的代码
    public void init() throws ServletException {
     
    }
      

  2.   

    参数写进地址栏为get请求,servlet处理要写在doGet()方法里。
      

  3.   

    没看出什么问题,你的servlet里具体怎么写的?
      

  4.   

    请在doGet方法里进行获取,doPost不可能获取到