*
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Parameters" Watch "Parameters" New topic
Author

Parameters

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)
regds.
- satya

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


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Vishakha Ahuja
Ranch Hand

Joined: Sep 13, 2000
Posts: 191
Thankyou very much.
Regards,
Vishakha.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Parameters