This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes post parameter in sort of input ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "post parameter in sort of input ?" Watch "post parameter in sort of input ?" New topic
Author

post parameter in sort of input ?

heiner weilandt
Ranch Hand

Joined: Sep 10, 2002
Posts: 46
hi,
i want to develop an servlet that takes unknown post-parameters one by one and take it to a mail. i have the problem that the right sort of these fields in the html-file are changes. i don't know the names of the parameters and i don't know how many parameters they are.
- do you habe any idea, how i can get the orignial-sort from the html-file ?
- can i get the original content-parameter-string and do it one by one on my own ?
please help.
heiner
Dominic Paquette
Ranch Hand

Joined: Dec 13, 2002
Posts: 64
Hi,
to get your parameters names you can use
HttpServletRequest.getParameterNames() or getParameterMap(), but you won't get them in the same order as the <input> feilds in you html form so I guess it's no use to you.
to get the query string try HttpServletRequest.getQueryString()
If the order of the parameters are important for you, maybee you can name you parameters with a counter or somethig like
<input type="text" name="param1"/>
<input type="text" name="param2"/>
<input type="text" name="param3"/>
Hope this helps
Dominic
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
I think getQueryString only gets the query part of the URL so it would only work with a GET. You could just get POSTed data as a stream using getInputStream, then parse it yourself.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: post parameter in sort of input ?
 
Similar Threads
how to pass parameters to a jsp page?
Getting parameters from doGet()
Help with Servlet Code
Parameters in HTML/Applet
Questions regarding servlet context and methods