File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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
It's not a secret anymore!