Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets inJSP

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How can i call a servlet from a html form?

i.e.

<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???


Thnx
 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

FIRST TAG:



SECOND TAG:



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 !

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Know it is simple but i wanted to confirm my idea

thnx
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find the easiest way to confirm ideas is to simply try them
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic