• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet context in Tomcat Production server

 
bhaskarvignesh chandra sekaran
Greenhorn
Posts: 17
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have hosted a web application in Tomcat using Jsp/servlet. My problem is am not able to access the ServletContext path. My jsp code is

My guess is that they have deployed my context app in a folder other than tomcat/web-app

how to access the my context
Please help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you give the web app a display name in the deployment descriptor?

What would this have to do with where the app was deployed?
 
bhaskarvignesh chandra sekaran
Greenhorn
Posts: 17
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution , with the below code

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What on Earth does that have to do with your original question?
 
bhaskarvignesh chandra sekaran
Greenhorn
Posts: 17
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to access the my context

What on Earth does that have to do with your original question?

The thing on Earth is that , Since i got access to my context, am able to create directories and upload files in them in my actual web-hosting space provided.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That certainly is a disconnect from your first post which asked about the web app display name, not the context path.

In any case, what you've got coded won't work in the general case. It will only work when the context path coincides with the file path of the web app, which is often not the case in production.

Rather, you should investigate getRealPath().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic