• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to use Relative path for a servlet (Using Tomcat server)

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to servlets.

I am trying to call my servlet from a HTML form. I dont want to use full url in action tag that will point to my servlet. I want to use relative path.

I am using tomcat 6 web server. If I am giving relative path in Action tag of HTML form, it is searching in C:\myApp\Servlet.

Please help me how I can use relative path in Tomcat server. If these is any other setting needs to be done for my application folder for relative path.


Thanks in advance.
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing Tomcat specific about this.

Your URLs should be server-relative and never page-relative. That is, they should start wit the the context path. See the JspFaq for details.
 
H S Kumar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:There is nothing Tomcat specific about this.

Your URLs should be server-relative and never page-relative. That is, they should start wit the the context path. See the JspFaq for details.



It would be helpful if you can give an example HTML form calling a servlet.
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic