aspose file tools*
The moose likes Tomcat and the fly likes Running JSP from outside tomcat\webapps\ROOT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Running JSP from outside tomcat\webapps\ROOT" Watch "Running JSP from outside tomcat\webapps\ROOT" New topic
Author

Running JSP from outside tomcat\webapps\ROOT

abhijeet srivastava
Greenhorn

Joined: Aug 22, 2006
Posts: 26
Hi!

To run jsp applications, we save jsp files in tomcat\webapps\ROOT folder.
But if I want to execute jsp files from anywhere but not in ROOT folder, let in c:\Test folder then what should I do? what would be changes in configuration? and which file configuration should be changed?

Bye....
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

To run jsp applications, we save jsp files in tomcat\webapps\ROOT folder.

No, you usually make a new folder in webapps. For example :
webapps/myapp/hello.jsp

And access it (after rebooting Tomcat) via localhost:8080/myapp/hello.jsp


[My Blog]
All roads lead to JavaRanch
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by abhijeet srivastava:

But if I want to execute jsp files from anywhere but not in ROOT folder



Please Check this Link to Set Up Your Development Environment


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There are several ways you can do this and they are container specific.
Moving to the Apache Tomcat forum.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Tomcat doesn't run "JSPs".
It runs web applications (which can contain JSPs).

So, the first thing you need to do is create a proper web application directory structure.
Suppose your app is to be named "myApp".
Create a directory named "myApp" and put it wherever you like.
Then, inside the myApp directory create another directory named "WEB-INF" (case sensitive).
OK, now you have a proper web application directory structure.
Put your JSPs in the myApp directory.

Now there are several ways you could deploy your web app.
1.) Drop the myApp directory (and all of its contents) in the {Tomcat install}/webapps directory.
Tomcat will automatically deploy the application for you .
You can then access your app with the following URL:
http://localhost:8080/myApp

2.) (this is probably what you're looking for)
Leave the myApp directory where is is and create a context fragment file
that lets Tomcat know where your app is.
Context fragment files go under:
{tomcat install}/conf/Catalina/localhost
The name of the file should match your contextPath ("myApp") with
a ".xml" extension.

Assuming you've created the myApp directory under "C:\Test", here
is an example context fragment file (named myApp.xml).


Once you've created this file and placed it in the tomcat/conf/Catalina/localhost directory, Tomcat will deploy your app.
You will be able to access it with:
http://localhost:8080/myApp


Hope this helps.
[ September 27, 2006: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running JSP from outside tomcat\webapps\ROOT