Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where to put Servlets, JSPs and HTML documents...  RSS feed

 
Tanveer Mehmood
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where should I place my servlets and JSPs with tomcat to run??? Also, what should be the location of HTML files... and depending on that location what would be right call to invoke that servlet or jsp(http://localhost???)
Hoping for early and comprehensive reply.
Tanveer
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tanveer,
*place your jsp pages and their html files on the following path:
tomcat_home\webapps\examples\jsp
note that you may create folders under the same path also.
**place your *.class files of your servlets under the path:
tomcat_home\webapps\examples\web-inf\classes
and place the html pages that call them under the path:
tomcat_home\webapps\examples\servlets
***call your servlet from the browser by typing the following
address in the title bar:
http://localhost:8080/examples/servlet/YourServletClassName
note that if you want to call the html file of your servlet,
you need the following address:
http://localhost:8080/examples/servlets/YourHtmlPage
and if your class files are in the expected directory, they
are going to be called automatically when the html page
requests one of them
Waiting for your commints...
Regards,
Jimi.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!