• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Where to deploy JSP and Servlet class files..

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
I am working on Tomcat 4.1.
Please answer the below questions,
1) Where do i need to deploy my JSP files and what is the exact URL to access them
2) Where do i need to deploy my Servlet class files and what is the exact URL to access them.
I can access my JSP files, if there are located at
<<instal_dir>>/Tomcat 4.1/webapps/examples.
But i am not able to access my JSP files, if they are located at sub directories below the examples directory, i.e., If my JSP files is located at,
<<instal_dir>>/Tomcat 4.1/webapps/examples/mydir
Please help, to solve the problem.
Thnaks in Advance,
Narasimha.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the jsp and the servlets can be accessed easily if they are put in folder at the same level as the examples folder.
you can create a folder say "Newproject" under the directory where the EXAMPLES folder is existing.
under the New Project folder, create a folder structure like
--NewProject
|__ jsp
|__ js
|__ WEB-INF
|__classes
put the jsp files under the jsp folder
put the javascript under the js folder
put the servlets (preferrably just the class files) under the web-inf/classes folder
access the jsp files the same way like
"Tomcat 4.1/webapps/NewProject/jsp/firstPage.jsp"
[actually the way the files has to be accessed through a browser is
http://localhost:8080/webapps/NewProject/jsp/firstPage.jsp
or
http://localhost:8080/NewProject/jsp/firstPage.jsp
which will require you to set the Context Root in the server.xml to "/NewProject"}
hope u find this helpful..
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
It is working fine now. Thanks a lot, but please clarify to me the below points,
(A)
1) When i tried to access the files using the below URL it is not working,
http://localhost:8080/webapps/NewProject/jsp/firstPage.jsp
2) But i can access the file, using the below URL,
http://localhost:8080/NewProject/jsp/firstPage.jsp
and here is the context root, i have set,
<Context path="/newproject" docBase="newproject" debug="0"
reloadable="true" crossContext="true">
Why is it so?
(B)
1) Can i set any number of context roots, i.e.,
<Context path="/newproject" docBase="newproject" debug="0"
reloadable="true" crossContext="true">
<Context path="/examples" docBase="examples" debug="0"
reloadable="true" crossContext="true">
But when i set multiple context roots, my server it self is not starting, why is it so?
Thanks a lot once again.
Regards,
Narasimha.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your URL 1 does not follow the servlet engine convention.
You can create any (reasonable) number of contexts but each one must conform to the "web application" convention before Tomcat will recognize it. For example, it must have a WEB-INF directory and a web.xml descriptor file.
You should download the servlet API from java.sun.com and study the requirements for a web application.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic