+ -
当前位置:首页 → 问答吧 → JSP request.getContextPath()问题

JSP request.getContextPath()问题

时间:2011-08-27

来源:互联网

代码如下:
<% request.setAttribute("attr", "Hello!");
  out.println("上下文路径为:"+request.getContextPath());
%>
为什么会没有显示出路径?要怎么去设置才能正确显示呢?

作者: qweorou   发布时间: 2011-08-27

如果项目放在root下面,则request.getContextPath());
返回为空字符串

作者: Fly_m   发布时间: 2011-08-27

楼上正解
另外在Server.xml里写的host path="" 的也是这种情况

作者: antiwise   发布时间: 2011-08-27

热门下载

更多