Skip to main content

passing parameters

1 reply [Last post]
dr_learn007
Offline
Joined: 2007-02-21
Points: 0

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.
saifuddin
Offline
Joined: 2007-02-27
Points: 0

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"
[Code]
request.getParameter("abc"); by this you can get the value.. of this text field
[/Code]

hope it helps.. or for more clarification see http://coreservlets.com inside Servlet & Jsp