my dog learned polymorphism*
The moose likes Servlets and the fly likes context path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "context path" Watch "context path" New topic
Author

context path

ravindranath
Greenhorn

Joined: Nov 07, 2004
Posts: 13
Hello
iam having problems with context path in server.xml file.i dont know where to change the context path(either in context root or context examples one).can somebody send me the details and full server.xml file.
i wrote a servlet called GreetingServlet and placed it in folder greeting ,placed it in c:/program files/java/tomcat 4.1/webapps folder.
thanks for your help in advance
tagore
haitham raik
Greenhorn

Joined: Aug 08, 2004
Posts: 17
Originally posted by ravindranath konduru:
Hello
iam having problems with context path in server.xml file.i dont know where to change the context path(either in context root or context examples one).can somebody send me the details and full server.xml file.
i wrote a servlet called GreetingServlet and placed it in folder greeting ,placed it in c:/program files/java/tomcat 4.1/webapps folder.
thanks for your help in advance
tagore

-----------------------------------------
there are a number of conditions that you have to follow to build a new web application.
to create a new web application follow the following steps:
1. create a new folder under the webapps folder for the tomcat (e.g., greeting folder)
2. create a subfolder in greeting folder called WEB-INF(required).
3. create a subfolder in WEB-INF directory called classes(required) and set any classes that you have created in this folder or any subfolder(for example com/GreetingServlet.class).
4. under the WEB-INF folder create a new file called web.xml(required).
5. in the web.xml file add the following text.
<web-app>
<servlet>
<servlet-name>greetingSer</servlet-name>
<servlet-class>com.GreetingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetingSer</servlet-name>
<url-pattern>*.greet</url-pattern>
</servlet-mapping>
</web-app>

6. restart the tomcat.
7. open the internet browser and print the following URL: http://localhost:8080/greeting/hello.greet and click Enter

now the output of your servlet will be displayed on your browser.


Haitham Raik<br />SCJP 1.4 SCWCD 1.4 SCBCD 1.3 SCJA 1.0
 
Consider Paul's rocket mass heater.
 
subject: context path