File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Servlets inJSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Servlets inJSP" Watch "Servlets inJSP" New topic

Servlets inJSP

Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136


How can i call a servlet from a html form?


<Form method="post" name="form" action = "???">

by submitting the form i want to call a servlet called Validate

and something else what files of the servlet should i use and save them in what folder???

Frederic Filiatrault
Ranch Hand

Joined: Jul 12, 2004
Posts: 69

Don't take it personal but you're question is very simple. You may want to read a little bit more about deploying files...

I'll give you a track:

your ACTION tag will have a value (e.g. TARGET1).

<form action="TARGET1" ...>

So, in your WEB.XML, you'll have two very important tags (it is not mandatory, but you should). First one will register your servlet, the second will map your servlet to a URL.



So, has you can see, the "MyFirstServlet" is a generic name you'll give in your web.xml (the name won't be used anywhere else). The URL could be anything you want. For example, in your web site is:

you'll have to type

to get your servlet running. So, the ACTION tag should be this link (absolute link or not, depends).

But, as I told you, there's a lot involved in this and it is very difficult to rapidly explain you all.

Hope this helps !

F.<br />SCJP, SCJD, SCWCD, SCBCD<br /> <br />Failure is not an option... It comes with the software bundle.
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

I Know it is simple but i wanted to confirm my idea

Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
I find the easiest way to confirm ideas is to simply try them

I agree. Here's the link:
subject: Servlets inJSP
jQuery in Action, 3rd edition