I am working on web application.I invoke on my jsp request.getContextPath(), but strangely I got address /streetshop.
Then I am appending some path as request.getContextPath() + "abc" and create folder.
Then its creating folder in D:// instead of my webapplication folder.
Please, tell me, I want to upload an image in put it in my web-application root/images/images.gif.
You mix things up here.
HttpServletRequest.getContextPath()returns your web application root path. In your example this is/streetshop, so your URL may look similar towww.myapp.com/streetshop. If you want to access the internal file system path, you must obtain it from theServletContextusingrequest.getServletContext().getRealPath("/"). This should return the location of your WAR files’WebContentfolder.Keep in mind that if you modify contents of this path during runtime, you’re going to loose everything when redeploying your application.