You could generate the names of the input fields with some thing like:

<form ..... >
<% for (i=0; i < 10; i++) { %>
    <input name="article<%=i%>" ....>
    <input name="qty<%=i%>" ...>
<% } %>
</form>

And in the action page:

<%
for (i=0; i < 10; i++) {
    article[i] = request.getParameter("article" + i);
    qty[i] = Integer.parseInt(request.getParameter("qty" + i));
}
%>

-- Antoni Reus

----- Original Message -----
From: "Mattias Jiderhamn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 12:59 PM
Subject: Re: Order of multiple values


Assume I have some shopping basket with multiple fields, articleId and
quantity, with a form like this:

Shopping basket:
  Article: [1000 ] Qty: [1 ]
  Article: [1001 ] Qty: [2 ]
  Article: [1002 ] Qty: [3 ]

You mean I'm not guaranteed that articleId[n] corresponds to
quantity[n]...?
How would I solve the above "problem" with a bean?

If it is dependent on the browser and server, are there any browsers and
server which CAN guarantee this?

--- Antoni Reus wrote: ---
No, as you say it depends on both the browser and the server, you can't
be
guaranteed.

----- Original Message -----
From: "Mattias Jiderhamn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 11:57 AM
Subject: Order of multiple values


If I use request.getParameterValues("key"), am I then guaranteed to get
the values in the same order as on the page/form?
I would be surprised if not, but I have some memory of somebody claiming
the opposite.

(I realize this depends on both the browser and the server)

  Mattias Jiderhamn
  Expert Systems
  [EMAIL PROTECTED]


=========================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to