×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

strange post data order

strange post data order

strange post data order

(OP)
Hi all. I've got a jsp class handling the display of a load of post data variables. In the previous page, I've got about 6 select controls each with data.

I've got to the stage where, when the form is submitted, the next page retrieves all the post data and displays the select control data in new select controls. This is for a summary type page where the user can review what they've done.

However, the post data doesn't seem to be in any order at all! Its not reversed or back to front or anything. It just seems random. I need to keep the select controls in the same order.

Does anyone know why the data should be reordered when its posted?
And does anyone know of a way to order the data in the way I want?

Cheers, Simon

RE: strange post data order

Hi

Quote (Simon):

However, the post data doesn't seem to be in any order at all!
Do you mean the list returned by ServletRequest.getParameterNames() is unordered ?
The only solution I can imagine is to handle the data manually. I do not think anyone else would base anything on such order. At least I definitely not.

Feherke.
http://rootshell.be/~feherke/

RE: strange post data order

(OP)
yeah. I'm using the getParameterNames method to retrieve all the options in numerous select controls. Can you suggest any other way to get all this data? regards, Simon

RE: strange post data order

I don't think the order is guaranteed. What about giving names to your controls?

Cheers,
Dian

RE: strange post data order

Hi

Quote (Simon):

Can you suggest any other way to get all this data?
I already suggested ( Ok, was in half words ) :

Quote (Feherke):

The only solution I can imagine is to handle the data manually.
For POST method would look like this :
  • The getReader() method will return a BufferedReader from which you can read the body of the request. There are the POST -ed data.
  • The getContentType() method will tell you the MIME type of the  request body. That is how the data is organized.
Not tried, just theory.

But better consider redesigning your code.

Feherke.
http://rootshell.be/~feherke/

RE: strange post data order

(OP)
thanks a lot everyone. Sorted it out now. Since I need to manipulate the data in order to create a report, I created a class and passed it the request object. From here I looped through the parameterNames, getting all the values and, since they were originally from select controls, putting all the data into vectors which were then saved as session variables. This seems to have worked nicely. Cheeeers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close