日期:2014-05-17  浏览次数:20621 次

servlet参数里面传递url的一个问题
请求的servlet的参数是"Hello?url=http://211.91.132.163/MapService/Location?telnum=13205658909&time=123542154",
在servlet里面,
String urlString=request.getParameter("url");
这urlString为何只是http://211.91.132.163/MapService/Location?telnum=13205658909,如何获得这个完整的参数??

------解决方案--------------------
你这样写系统把你的参数看成了url=http://211.91.132.163/MapService/Location?telnum=13205658909 和 time=123542154 两个参数了
------解决方案--------------------
String urlString=request.getParameter("url");
String time=request.getParameter("time");
String result=urlString+time;
呵呵
------解决方案--------------------
探讨
你这样写系统把你的参数看成了url=http://211.91.132.163/MapService/Location?telnum=13205658909 和  time=123542154  两个参数了

------解决方案--------------------
String fullurl = request.getRequestURI();
String url = fullurl.substring(fullurl.indexOf("?"), fullurl.length());
------解决方案--------------------
可不可以先把http://211.91.132.163/MapService/Location?telnum=13205658909 encode,然后再
String urlString=request.getParameter("url")后 decode urlString
------解决方案--------------------
Hello?url=”http://211.91.132.163/MapService/Location?telnum=13205658909&time=123542154“

用双引号,不要单引号