public String getRealPath(String path)
public boolean isRequestedSessionIdFromUrl()
不赞成在新代码中使用这些方法,他们是为了与已存在的代码保持兼容而设计的,
用request.getRequestURI()
public boolean isRequestedSessionIdFromUrl()
不赞成在新代码中使用这些方法,他们是为了与已存在的代码保持兼容而设计的,
用request.getRequestURI()
String strUrlFile = request.getRealPath("systemmsg.pro");
运行结果正确,就是有警告信息,我知道用request.getRequestURI()方法,但是,那取的只是相对路径啊,我因为开发的是产品,为了方便想取绝对路径比较好,是不是取绝对路径只有这个方法呢?
如果向返回一个特定文件的路径可以这样:
ServerletContext.getSource("fileName");
我要取的是一个自定义的出错信息提示文件,systemmsg.pro是我自定义的,request.getPathTranslated()不传参数不合我的要求,而且取出来的是null值!
To zxhong(红):
不是系统文件
To treeClimber(is):
可能你的方法我可以用,不过ServerletContext是在哪个包下面?