On Tue, 1 Jan 2002 10:06:23 -0800, suresh chaluvadi <[EMAIL PROTECTED]> wrote:
>Hi Abraham,
> I just Installed tomcat 3.2.3 and places
>html,servlet files as u said.And redirect method is
>working fine.
> I placed the files in root directory.But suupose
>If I want to create My own folder in Tomcat.how to do
>that?
>Thanks & Regards
>Suresh
>--- Abraham Varghese <[EMAIL PROTECTED]>
>wrote:
>> Suresh,
>>
>> If you are using TOMCAT as your Servlet container,
>> here is what you need
>> to do.
>>
>> Assuming that you have installed Tomcat at
>> C:\tomcat; your
>> servlet class is 'Serv01.class' and the html page
>> you need to
>> redirect to is 'test01.html'
>>
>> Place your test01.html at C:\tomcat\webapps\ROOT
>>
>> To redirect to an HTML page
>>
>> response.sendRedirect("/test01.html");
>>
>> To redirect to another Servlet
>>
>> response.sendRedirect("/servlet/Serv02");
>>
>> Your Serv01.class and other servlet classes should
>> be copied to
>> C:\tomcat\webapps\ROOT\Web-Inf\classes
>>
>> Start Tomcat
>>
>> Access your Serv01.class as follows
>>
>> http://localhost:8080/servlet/Serv01
>>
>> Good Luck !
>>
>>
>___________________________________________________________________________
>> To unsubscribe, send email to [EMAIL PROTECTED]
>> and include in the body
>> of the message "signoff SERVLET-INTEREST".
>>
>> Archives:
>>
>http://archives.java.sun.com/archives/servlet-interest.html
>> Resources:
>>
>http://java.sun.com/products/servlet/external-resources.html
>> LISTSERV Help:
>> http://www.lsoft.com/manuals/user/user.html
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Send your FREE holiday greetings online!
>http://greetings.yahoo.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
Here is what you need to do to have your own folders. Let's say you want to create a
folder 'abraham'. Open up Win Explorer create 'abraham' under c:\tomcat\webapps
Remember all new app directories you create should go under c:\tomcat\webapps ( not
100 % sure :) but will get you going ! )
Change to the new directory abraham
1. Under abraham , create WEB-INF
2. Under WEB-INF create another directory classes
So now you have C:\tomcat\webapps\abraham\WEB-INF
and C:\tomcat\webapps\abraham\WEB-INF\classes
Copy web.xml available at C:\TOMCAT\webapps\ROOT\WEB-INF to
C:\tomcat\webapps\abraham\WEB-INF
Copy your static HTML pages, GIFs etc to C:\tomcat\webapps\abraham
Your Servlet classes goes to C:\tomcat\webapps\abraham\WEB-INF\classes
Now to the most important step..
I assume by now you know the significance of SERVER.XML in Tomcat. If not
read about it in documentation .
This file is available at c:\tomcat\conf. Make a copy of this file before you edit it.
Inside this file there will be a 'Context' tag. as shown below
<Context path="/examples" docBase="webapps/examples" crossContext="false" debug="0"
reloadable="true" />
Make a copy of this line and on the copy change it to
<Context path="/abraham" docBase="webapps/abraham" crossContext="false" debug="0"
reloadable="true" />
Save the file and stop and restart tomcat
When you access the Servlet the URL should be
http://localhost:8080/abraham/servlet/Serv01
When you redirect to another servlet from Serv01
response.sendRedirect("/servlet/Serv02")
There is no need for '/abraham ' before /servlet because tomcat
already knows the context when it was started.
To another static HTML Page
response.sendRedirect("/test01.html");
You could have other subdirectories under 'abraham' let's say 'images'
if you want to access a gif from this directory, you should code it as
<IMG SRC='../images/pic01.gif'> . The two dots are very important !
You may also want to read more about forward() method and when you should use it.
Good Luck !
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html