See below for comments...
Biju Nambisan wrote:
[ . . . ]
> A typical URL with parameter in this case is something like this
>
> http://localhost:4444/xyz.jsp? myselect_sk0=wh&myselect_macro0=weather
> &myselect_sk1=sp&myselect_macro1=sports &change=CHANGE
[ . . . ]
> parameter..When I am trying to print the values in the enumeration
> object it typically prints all the values in the following manner
>
> myselect_sk0(first checkbox element in the first row)
> myselect_sk1(first checkbox element in the second row)
> myselect_sk2(first checkbox element in the third row)
> ...........so on
> change (the button element )
> myselect_macro0(second checkbox element in the first row)
> myselect_macro1(second checkbox element in the second row)
> myselect_macro2(second checkbox element in the third row)
> ...........so on
>
> 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..
The fundamental issue is that getParameterNames() returns keys from a
HashTable (in all servlet engine implementations that I've seen).
Hastables, as any data structures textbook tells you, do NOT guarantee
the order of elements, and is most cases do really strange things with
the ordering. The Servlet spec is not clear about this limitation, but
as your experiment has shown, if it does not explicitly state anything
about sorting, you cannot count on that.
Nor can you count on web browsers submitting form element values to you
in the order they were shown in the HTML page. HTTP/HTML specifications
again make no guarantee about form element processing.
Your best bet is to name your form elements in a sortable order, use
getParameterNames() to put the parameter names into a data structure
that DOES guarantee sort order (see JDK 1.2's java.util.TreeMap) and
pluck the elements out of that.
[ . . . ]
> 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..
I believe the practical limit of an HTTP GET is about 255 chars
*total*. There is no upper bound on HTTP POST.
===========================================================================
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