aspose file tools*
The moose likes Servlets and the fly likes regarding servlet mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "regarding servlet mapping" Watch "regarding servlet mapping" New topic
Author

regarding servlet mapping

Sreejith Padmanabhan
Greenhorn

Joined: Oct 10, 2007
Posts: 10
Dear all,
if any one can tell me step by step how to do servlet mapping using Apache Tomcat 6.0, i would be highly obliged.

Sreejith
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
Tomcat is the reference implementation of the servlet specification, so its does servlet mapping exactly according to the spec. Do you have a specific question about servlet mapping? Have you read the corresponding sections of the spec?
Sreejith Padmanabhan
Greenhorn

Joined: Oct 10, 2007
Posts: 10
Dear sir,
Let me tell you my problem specifically-

I have a html page with a form as below:-




and a servlet class for the same like below -


when i am clicking on the submit button, it is giving me a 404 error.

can you tell me what the problem could be.
S Reddy
Ranch Hand

Joined: May 17, 2007
Posts: 45
Are you sure this path "ServletProject/Try" is relative to the current page? If it is relative to the application it should be "/ServletProject/Try".
Sreejith Padmanabhan
Greenhorn

Joined: Oct 10, 2007
Posts: 10
Sir even if i try to give ServletProject/Try or /ServletProject/Try, it is not working. for your reference, i am adding the web.xml file too with this
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
Both "ServletProject/Try" and "/ServletProject/Try" could be problematic in the HTML. Anything starting with "/" is an absolute URL that may be invalid if the web app is not the ROOT web app.

Have a read of http://faq.javaranch.com/java/RelativeLinks for lots more explanations and solutions.
[ February 17, 2008: Message edited by: Ulf Dittmer ]
Sreejith Padmanabhan
Greenhorn

Joined: Oct 10, 2007
Posts: 10
So how can i get the output, can you tell me
S Reddy
Ranch Hand

Joined: May 17, 2007
Posts: 45
<url-pattern>Try</url-pattern> and
<form method="post" action="/ServletProject/Try" name="UserForm">
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Where is your servlet's class file?
Post the complete path, including the drive letter.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding servlet mapping