What does servletcontext.getRealPath(“/”) mean and when should I use it

后端 未结 4 793
无人及你
无人及你 2020-11-22 01:32

In the following snippet:

ServletContext context = request.getServletContext();
String path = context.getRealPath(\"/\");

What does /

4条回答
  •  爱一瞬间的悲伤
    2020-11-22 01:43

    There is also a change between Java 7 and Java 8. Admittedly it involves the a deprecated call, but I had to add a "/" to get our program working! Here is the link discussing it Why does servletContext.getRealPath returns null on tomcat 8?

提交回复
热议问题