aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 12682
    
    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
 
Don't get me started about those stupid light bulbs.
 
subject: post parameter in sort of input ?
 
Similar Threads
how to pass parameters to a jsp page?
Help with Servlet Code
Parameters in HTML/Applet
Questions regarding servlet context and methods
Getting parameters from doGet()