Kushan
Kushan

Reputation: 27

directory structure in Tomcat 5(s)

I was wondering if it was possible to maintain a directory structure within the application folder in side webapps folder, i.e. I have created a folder called ITC357, which acts as my application folder which carries all my files, so the directory path is as follows:

C:/Program Files/Tomcat5/webapps/ITC357

I'm doing an assignment and I would like to deploy that ITC357 in a separate folder can I do this? if so how?

Upvotes: 0

Views: 437

Answers (2)

Jay
Jay

Reputation: 27474

If you are writing JSPs, then the URL of the JSP will include any subdirectories that you create. So if under ITC357 you create a subdirectory called "foo", and in that subdirectory you have a JSP called "bar.jsp", and your context name is "plugh", then the URL of that JSP will be "http://whateverserver.com/plugh/foo/bar.jsp".

If you are using servlets, then it is up to your code to decide what to do with any URLs passed to it. You could map "http://whateverserver.com/plugh/foo/twisty.do" to "c:/program files/tomcat5/webapps/ITC357/WEB-INF/classes/foo/twisty.class", or you could map it to someplace totally different. (I prefer to map to a package name that matches the URL unless there's good reason to do otherwise.)

Upvotes: 0

Stephen C
Stephen C

Reputation: 718826

It is not clear what you are asking:

  • If you asking if it is possible to have directories inside C:/Program Files/Tomcat5/webapps/ITC357 then the answer is "Yes".

  • If you are asking if it is possible to put your webapps file in a separate directory then the answer is "Inadvisable". The tomcat framework looks for certain files within the webapps/<name> tree; e.g. a context.xml file, a web.xml file, classes / JARs, etc. You could code your servlet to look for other things in other places, but this causes various problems with deployment (and undeployment) and security.

If that doesn't cover it, please clarify your question.

Upvotes: 1

Related Questions