我在ie上的url是这个
http://localhost:8080/Information/student.action?pager.offset=10
我在一个FILTER里写的函数int offset = 0;
try {
System.out.println(request.getParameter("pager.offset"));
offset = Integer.parseInt(request.getParameter("pager.offset"));
System.out.println("nonononononono");
} catch (NumberFormatException ignore) {
System.out.println("nononononononorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
}
return offset;打印出来的结果:
null
nononononononorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
null
nononononononorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

解决方案 »

  1.   

    参数中间不可以用".",否则他怎么知道你不是XXX.jsp呢?更改参数的名字,或者进行编码然后再传递.
      

  2.   

    offset = Integer.parseInt(request.getParameter("pager.offset"));
    改成 offset = (new Integer(request.getParameter("pager.offset"))).intValue;
    试一下
      

  3.   

    结果很明显: request.getParameter("pager.offset") 为null.就是获取不到值.
    你说你测试过可以用".", 有测试代码吗???
      

  4.   

    在一个servlet里写这段程序是没有问题的
    但在一个filter里就出现上面的问题了out.println("tttttttttttttttttttttttttttttttttttt");
    out.println("hello"+request.getParameter("name"));
    out.println("hello"+request.getParameter("test.name"));
    out.println("tttttttttttttttttttttttttttttttttttt");
      

  5.   

    Filter里貌似request对象要强制转换一下吧. 
    转成HttpServletRequest格式,LZ是不是忘了转了
      

  6.   

    你可以指定这个过滤器单独过滤传参数的那个页面就不会获得不到值了。!!
      在filter过滤时没指定特定的页面而是一个包下的或是某一类的页面,!!
    简单的说就:
    单独的这个页面指定咯参数但别的页面却没又指定啊,别的页面我相信也没必要指定那些参数