This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Parameters" Watch "Parameters" New topic


Vishakha Ahuja
Ranch Hand

Joined: Sep 13, 2000
Posts: 191
Can I pass parameters to servlet without using .xml file
I mean, can I use HTML form to collect user's info and pass it as parameter to servlet for displaying ?
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
Yes you can , you can do it though the HttpServletRequest object. It provides you with a method called getParameter("txtName") txtName is the name of a text field on the html form. If you are submiting multiple parameters like an array of checkboxes or radio buttons then use getParameterValues("fieldName") method

Val SCJP <BR>going for SCJD
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Also, through Hidden fields on the HTML form.
and Cookies (though not on the Form fields)
- satya

[This message has been edited by Madhav Lakkapragada (edited April 25, 2001).]

Take a Minute, Donate an Hour, Change a Life
Vishakha Ahuja
Ranch Hand

Joined: Sep 13, 2000
Posts: 191
Thankyou very much.
I agree. Here's the link:
subject: Parameters
jQuery in Action, 3rd edition