Skip to main content

passing parameters

1 reply [Last post]
Joined: 2007-02-21

you can run a java program by typing: java param1 param2 param3 etc
how can you run a program in a servlet by entering multiple parameters via a form and then envoking the servlet.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-02-27

lets suppose : have an html page with 3 text fields
inside form element action attribute is used to specify the name servlet with its actual path.. or define the method inside your method attribute which can be POST/ GET
invoking a servlet by submit button ( can say send a request to the server on specified servlet) then servlet handle the request by it's defined method it can be doPOST/doGET or other doXXX http methods.

after handle this request you can receive these parameter by "getParameter" method of HttpRequest Interface.

for example
your text field name is "abc"
request.getParameter("abc"); by this you can get the value.. of this text field

hope it helps.. or for more clarification see inside Servlet & Jsp