Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HTML to Servlet?

 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get information from my HTML file to my servlet I am using the following code. When I run it the information is not in the right order. How do I change the order?
out.println("<h1>Donna Bachner's Tax Preparation Service</h1>");
out.println("<form>");
Enumeration Name = request.getParameterNames();
String name = (String) Name.nextElement();
out.println(name );
String [] value = request.getParameterValues("name");
name = (String) Name.nextElement();
out.println(name );
value = request.getParameterValues("name");
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't.
Parameters are stored in a map and, as such, are not guaranteed to be in any particular order. I don't the the browsers are required to send them in any particular order either.

Why do you need them to be ordered?
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to do some calculations and I need them displayed in the order the orignal HTML file was printed with the added calculations in the list.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then give them names that will allow you to get them in whatever order you want.






Or something like that....
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try that. Let you know how it works.
 
I do some of my very best work in water. Like this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!