JSP杂记

1、请求URL为:http://ip:port/industry.model/middle/a.b.c.test.ajax?a=b&c=d

request.getContextPath(); //得到:/industry.model
request.getServletPath();  //得到:/middle/a.b.c.test.ajax
request.getRequestURI(); //得到:/industry.model/middle/a.b.c.test.ajax
request.getQueryString(); //得到:a=b&c=d

 

 

 

 

 

 

你可能感兴趣的:(jsp)