wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to use Relative path for a servlet (Using Tomcat server) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to use Relative path for a servlet (Using Tomcat server)" Watch "How to use Relative path for a servlet (Using Tomcat server)" New topic
Author

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

H S Kumar
Greenhorn

Joined: Jun 08, 2011
Posts: 10
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
H S Kumar
Greenhorn

Joined: Jun 08, 2011
Posts: 10
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.
 
Consider Paul's rocket mass heater.
 
subject: How to use Relative path for a servlet (Using Tomcat server)
 
Similar Threads
servlet beginner confused
server to server call
problem in form action tag
specifiying URI
CSS is not coming into effect