Biju Nambisan wrote:
>
> I am facing a peculiar problem which I would like to share with the
> group..
>
> I am trying to do an HTTP "get" to send the form element values to a
> JSP.I do this using a request.getParameterNames() which returns an
> Enumeration object.I am trying to read this Enumeration using the
> enumeration objects nextElement() method into a vector which will be
> used for further processing based on the data retreived.
> [...]
> If you have a look at the order of the parameter that are being passed
> they are in the order
>
>myselect_sk0=wh&myselect_macro0=weather&myselect_sk1=sp&myselect_macro1=sports&change=CHANGE...
> ie first checkbox element in the first row,second checkbox element in
> the first row,first checkbox element in the second row,second checkbox
> element in the second row and so on...........
>
> But on being stored in the enumeration they are getting stored in the
> way shown above..This is unuusal to me..
> I want to avoid the change button value which is getting read in between
> the two textbox element values as when i read the element values in a
> loop the loop gets exhausted before the last element is
> processed..giving me a java.util.NoSuchElementException : HashTable
> Enumerator
> [...]
In general, you can not count on request parameters from a FORM being
sent in any specific order; there's no such gurantee in any spec I know of.
Also, within a servlet container a Hashtable is usually used to hold the
parameters, and the hash algorithm makes things come out in pretty much
a random order when you call getParameterNames().
So I suggest you do something like this for each of your numbered parameters
(sk, macro, etc.) instead:
Vector macros = new Vector();
for (int i = 0; true; i++) {
String macro = request.getParameter("myselect_macro" + i);
if (macro == null) {
// No more macros
break;
}
macros.addElement(macro);
}
> I would also like to know if there are any limitations of the no of
> characters that can be sent in a post/get methods..I believe the get
> method has a limit of 256 chars for it to behave properly ..Correct me
> if I am wrong..
Some products limit GET requests, possibly to around 256 chars (don't quote
me on that number). POST requests do not have any lenth limits, since all
parameters are sent as the body of the request and the length is specified
by a Content-Length header.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets