Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > jsp combine multiple values

Reply
Thread Tools

jsp combine multiple values

 
 
grasp06110@gmail.com
Guest
Posts: n/a
 
      02-08-2009
Hi Everybody!

I have a page that has several inputs with multiple parts For
example, I have 5 records and each has a name field, a rank field, and
a serial number field. My understanding is that if this form is
submitted to a servlet there is no assurance that the parameters will
be processed in order so if I want to keep the first rank and id with
the first name I can't just iterate through the respective collections
returned by getParameter("name"), getParameter("rank"), getParameter
("serialNumber"). Is there an easy way to correctly associate the
name, rank, and serial numbers for the 5 individuals that insures they
wont get mixed up? Is there a framework that handles this well?

Thanks,
John

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      02-08-2009
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi Everybody!
>
> I have a page that has several inputs with multiple parts For
> example, I have 5 records and each has a name field, a rank field, and
> a serial number field. My understanding is that if this form is
> submitted to a servlet there is no assurance that the parameters will
> be processed in order so if I want to keep the first rank and id with
> the first name I can't just iterate through the respective collections
> returned by getParameter("name"), getParameter("rank"), getParameter
> ("serialNumber"). Is there an easy way to correctly associate the
> name, rank, and serial numbers for the 5 individuals that insures they
> wont get mixed up? Is there a framework that handles this well?


Give each input field a different name.

--
Lew
 
Reply With Quote
 
 
 
 
Tom Anderson
Guest
Posts: n/a
 
      02-08-2009
On Sun, 8 Feb 2009, (E-Mail Removed) wrote:

> I have a page that has several inputs with multiple parts For example, I
> have 5 records and each has a name field, a rank field, and a serial
> number field. My understanding is that if this form is submitted to a
> servlet there is no assurance that the parameters will be processed in
> order so if I want to keep the first rank and id with the first name I
> can't just iterate through the respective collections returned by
> getParameter("name"), getParameter("rank"), getParameter
> ("serialNumber"). Is there an easy way to correctly associate the name,
> rank, and serial numbers for the 5 individuals that insures they wont
> get mixed up?


You have to give the fields different names. For instance:

record.0.name
record.0.rank
record.0.serialNumber
record.1.name
record.1.rank
record.1.serialNumber
record.2.name
record.2.rank
record.2.serialNumber

etc. Alternatively:

name.0
rank.0
serialNumber.0
name.1
rank.1
serialNumber.1
name.2
rank.2
serialNumber.2

> Is there a framework that handles this well?


I know next to nothing about web frameworks, so i can't answer that, but i
strongly suspect that most of the big ones do.

tom

--
Yulava? Niob Yam!
 
Reply With Quote
 
Wojtek
Guest
Posts: n/a
 
      02-08-2009
(E-Mail Removed) wrote :
> My understanding is that if this form is
> submitted to a servlet there is no assurance that the parameters will
> be processed in order so if I want to keep the first rank and id with
> the first name


Where did you read this?

In browsers I have tested against (SeaMonkey, IE, Firefox) the values
were kept together.

--
Wojtek


 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      02-09-2009
On Sun, 8 Feb 2009, Wojtek wrote:

> (E-Mail Removed) wrote :
>> My understanding is that if this form is
>> submitted to a servlet there is no assurance that the parameters will
>> be processed in order so if I want to keep the first rank and id with
>> the first name

>
> Where did you read this?
>
> In browsers I have tested against (SeaMonkey, IE, Firefox) the values
> were kept together.


I think the HTML specification mandates it, actually, but i wouldn't want
to rely on it.

tom

--
A is for Absinthe, for which I now thirst
 
Reply With Quote
 
Wojtek
Guest
Posts: n/a
 
      02-09-2009
Tom Anderson wrote :
> On Sun, 8 Feb 2009, Wojtek wrote:
>
>> (E-Mail Removed) wrote :
>>> My understanding is that if this form is
>>> submitted to a servlet there is no assurance that the parameters will
>>> be processed in order so if I want to keep the first rank and id with
>>> the first name

>>
>> Where did you read this?
>>
>> In browsers I have tested against (SeaMonkey, IE, Firefox) the values were
>> kept together.

>
> I think the HTML specification mandates it, actually, but i wouldn't want to
> rely on it.


Really?

Well then do a test at login. Place a couple of hidden value pairs
within the login form, then test them when the user cliks on the login
button.

If the values are out of sync, then log it (to create browser stats)
and inform the user with some helpful message.

--
Wojtek


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP and Javascripts on same page (Passing values to JSP fromJavascript) Husain Javascript 3 04-14-2008 10:36 AM
How to combine multiple .mov files under Linux? somebody DVD Video 0 11-27-2007 10:39 PM
how to combine multiple websites into one main site thatsastounding@gmail.com ASP .Net 0 12-07-2006 02:36 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Combine multiple DVD to a single DVD Cara Stancinni DVD Video 15 01-21-2005 05:04 PM



Advertisments