Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Submit from to a servlet

 
Vinodh Kaliya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form that needs to submit its data to a servlet . The servlet has been defined in the web.xml . The form lies in a webpage that is not part of the url-pattern that has been described in the web.xml .

What should i put in my action so that upon pressing the submit button the data will be sent to the servlet ?

<Form Method="Get" Action=" ? ">
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The context path for the application followed by the mapping for the servlet.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
welcome to javaranch
 
Vinodh Kaliya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help Bear-B. It is working now. So to access the servlet (if there are multiple servlets also) then we use their appropriate mapping that pertains to that servlet.

hi Seetharaman.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is the whole purpose of the mapping.
 
Soumya Rout
Ranch Hand
Posts: 49
Java Java ME Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mention the servlet name name in the form action.

Like if your servlet name is Demo and url-pattern .do then write <form method="GET/POST" action="Demo.do">

Try it ..

If still problem then reply .

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soumya Rout wrote:Mention the servlet name name in the form action.

He already reported that it's working. Why are you adding more info, and that's not even accurate?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic