Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why ???  RSS feed

 
erik weibust
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a simple HelloWorld servlet in C:\tomcat\webapps\ROOT\WEB-INF\classes and html calling it in C:\tomcat\webapps\ROOT. why do i have to use ../servlet to call it in my form tag like this: <FORM METHOD="GET" ACTION="../servlet/HelloWorld"> when it's not in a servlet directory?
thanks for helping clear this up,
erik
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually you could also call it by typing www.yourdomain.com/servlet/HelloWorld. You have to type /servlet because TOMCAT is set up to know that by including this you are requesting a servlet. TOMCAT has also mapped a call to /servlet to the webapps/ROOT directory in TOMCAT.
You can actually go in and specify your own mappings if you want, but it's easier to accept the default whil you are learning.
Jason
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The directory Web-inf/classes is mapped to servlet by default.
 
erik weibust
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why does tomcat care if the request is for a servlet? and isn't it obvious becasue if the requestor wanted a jsp his request would end in *.jsp???
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Not necessarily, you could have tomcat map any extension to a JSP if you wanted to. Tomcat only treats .jsp files as JSP cause that is what it is told to do by default. If you wanted to you could map .crap (or .asp) files to be compiled as JSPs.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!