getServletContext().getRealPath("/"):
来源:互联网 发布:java转码utf-8转gbk 编辑:程序博客网 时间:2024/05/22 02:05
http://zhidao.baidu.com/question/408005631.html
getrealpath()
http://stackoverflow.com/questions/11398513/eclipse-problems-with-getrealpath
disable server location
http://stackoverflow.com/questions/1012378/eclipse-server-locations-section-disabled-and-need-to-change-to-use-tomcat-ins/1012459#1012459
问题:
使用getServletContext().getRealPath("/")获取地址得到\eclipseworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps,而不是对应项目目录
分析:
该目录为eclipse中发布工程的临时目录。
解决:
Click on > Servers Tab. Right Click on Servlet container (Tomcat 7 in your case) and Open (F3 is shortcut for eclipse).
Specify the server path (i.e. catalina.base) and deploy path.
You can specify the deploy location here.
如果,修改项为灰色disable。则先进行以下步骤:
- Right click on my tomcat server in "Servers" view, select "Properties…"
- In the "General" panel, click on the "Switch Location" button
- The "Location: [workspace metadata]" bit should have been replaced by something else.
- Open (or close and reopen) the Overview screen for the server.
附:
getRealPath
String getRealPath(String path)
- Returns a
String
containing the real path for a given virtual path. For example, the path "/index.html" returns the absolute file path on the server's filesystem would be served by a request for "http://host/contextPath/index.html", where contextPath is the context path of this ServletContext..The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns
null
if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a.war
archive). - Parameters:
path
- aString
specifying a virtual path- Returns:
- a
String
specifying the real path, or null if the translation cannot be performed
- getServletContext().getRealPath("/"):
- getServletContext().getRealPath("/")
- getServletContext.getRealPath()问题
- request.getSession().getServletContext().getRealPath("/");
- getServletContext().getRealPath("/")的测试
- this.getServletContext().getRealPath("/"); 是什么意思
- getServletContext().getRealPath()问题
- ServletContextFactory.getServletContext().getRealPath("/")的作用
- request.getRealPath("/");替换为request.getSession().getServletContext().getRealPath("/");
- servlet中getServletContext().getRealPath("/")相关问题收集
- weblogic war 路径 getServletContext().getRealPath() null 解决办法
- servlet中getServletContext().getRealPath("/");的路径
- request.getSession().getServletContext().getRealPath 为null
- getServletContext().getRealPath()异常或为null
- ServletActionContext.getServletContext().getRealPath("/upload");myeclipseyeclipse获取路径不一样的原因
- HttpServletRequest中的getServletContext().getRealPath("/")中“/”和“”的区别
- request.getSession().getServletContext().getRealPath(“/updload/video/”) 得到项目的绝对路径
- javaweb中 ServletActionContext.getServletContext().getRealPath("")获得服务器路径
- android使用JSON进行网络数据交换
- mysql将一张表的查询结果存到另一张表中
- 修复 Eclipse 警告:不能读取 AppletViewer 的属性文件
- Java 异常处理学习与理解
- 判断四点共面
- getServletContext().getRealPath("/"):
- 苹果新的编程语言 Swift 语言进阶(二)--基本数据类型
- 20140915
- c++ 类中static成员的使用
- 老板必看的快消品网站建设团队策划流程
- UIButton使用详解
- <<汽车是怎样跑起来的>> 简评
- java 多线程学习理解
- android 的 sp 智能指针用法介绍 sp<> wp<>