Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Current working directory for Servlet in Tomcat?

 
Jack Doson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when ever you want forward request to any jsp or other servlet from servlet will give some thing like this.>!

RequestDispather rd=request.getRequestDispather(/EmpDisplay.jsp);

rd.forward(request,response);

it means some how servlet container is running our application in main application folder(directory) of our directory..!

is it correct...?

Thanks for reading and Helping.!
[ October 02, 2008: Message edited by: Bear Bibeault ]
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand you correctly, the answer is "yes."

If the path passed to getRequestDispather starts with a "/", then the location is relative to the root of the WAR archive.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not always. That may be true for JSPs, but servlets are mapped according to elements in the deployment descriptor and are not addressed relative to the file system.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Jack Doson", please check your private messages for an important administrative matter. Again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic