Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding servlet mapping

 
Sreejith Padmanabhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So how can i get the output, can you tell me
 
S Reddy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<url-pattern>Try</url-pattern> and
<form method="post" action="/ServletProject/Try" name="UserForm">
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is your servlet's class file?
Post the complete path, including the drive letter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic