Hi Pierre, 

It's a simple set-up. 

Assuming you are using Tomcat 5.x or greater

Say you have your project with all source files in this directory structure:
C:\dev\projects\YourProjectName\__source\

and under __source\ you have other folders such as java (for java source 
files), web (for mostly jsp files) - it doesn't matter what structure you have 
in your source folder.

The wrong set up for dev environment was to deploy whatever whas in the 
__source to C:\dev\apache-tomcat-5.5.12\webapps\ , to see changes to JSP.

The right setup for dev is to first remove your project folder which may be 
under C:\dev\apache-tomcat-5.5.12\webapps\  either in a form of a folder or WAR 
file. If you have both, remove both of them. 

Now, all you have to do is, modify your project's Context file located under:
C:\dev\apache-tomcat-5.5.12\conf\Catalina\localhost\  , 
If you don't have one you can create one with the name ROOT.xml if your project 
is accessed via root like http://localhost:8080/  or if you have another
context name like SomeApp, then you can name it SomeApp.xml 
http://localhost:8080/SomeApp/  It doesn't matter what you name the context xml 
file according to the docs. 

Then inside the above context XML file define your context for example:
<Context docBase="C:/dev/projects/YourProjectName/__source"
         privileged="false" antiResourceLocking="false" antiJARLocking="false" 
crossContext="false" reloadable="true" cachingAllowed="false">
</Context>
The full syntax of what you can specify in the Context is available here: 
http://tomcat.apache.org/tomcat-5.0-doc/config/context.html

This makes Tomcat point to the directory you have specified under *docBase*. 
From now on Tomcat will use docBase of the project to load your source files 
instead of using Tomcat's webapps folder.

Now re-start Tomcat and make some changes to your JSP file and you can simply 
refresh your browser to see the changes, no need to perform ANT or other deploy 
to webapps to see your changes.

This kind of set up has other advantages. You can easily control which projects 
you want Tomcat to load, this keeps the Tomcat's console cleaner and also makes 
your app in development environment faster since the number of projects is 
reduced. 

I don't know which Tomcat version you are using.

The above setup works in Tomcat 5.x or greater. 

For lower version of Tomcat the configuration is slightly different, since a 
separate Context xml file feature was not available then. I think if you have a 
lower version of Tomcat below 5.x you'll have to modify the Context entry in 
server.xml . I havent tried or tested this but I'm only guessing and not sure 
if it will work.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OT but slightly related. If you have more than 1 projects then set-up virtual 
hosts for your project instead of having a Context file under 
C:\dev\apache-tomcat-5.5.12\conf\Catalina\localhost\  modify server.xml located 
under 

C:\dev\apache-tomcat-5.5.12\conf\

There's more info on this on a previous thread


----- Original Message ----
From: Pierre Goupil <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Saturday, December 2, 2006 1:17:41 PM
Subject: Quick webapp reloading [was : Is jsp designed for use by large 
websites]


Hello, listers !


2006/11/30, Rashmi Rubdi <[EMAIL PROTECTED]>:


Remy is right, with JSPs also it's possible to instantly see your changes by
> simply refreshing your browser.
>
> I would like to add though that this purely depends on how your project is
> set up.
>
> You can have Tomcat point to the folder which contains the *source code*
> this is what allows one to instantaneously see the changes made to a JSP
> page. Do this in the development environment.
>
> Many (including myself) thought that we have to deploy all source files
> from source folder to Tomcat's webapps folder to see the changes made to the
> JSP. You can easily avoid this deploy cycle by simply pointing Tomcat to the
> source folder either in your app's context file which is located at:
> \apache-tomcat-5.5.12\conf\Catalina\localhost
>
> OR
>
> inside Host configuration in server.xml
>
> This will save a lot of time and clicks and changes to JSPs can be seen
> instantaneously simply by refreshing your browser.
>
>
Could you, please, tell me more about this, M. Rashmi ?


Regards,


Pierre



-- 
"L'une des raisons pour lesquelles la vie est complexe
C'est qu'elle a une partie réelle et une partie imaginaire."


 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to