aspose file tools
The moose likes Servlets and the fly likes HTML to Servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "HTML to Servlet?" Watch "HTML to Servlet?" New topic
Author

HTML to Servlet?

Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
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

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
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

Joined: Dec 11, 2004
Posts: 13410

Then give them names that will allow you to get them in whatever order you want.






Or something like that....
Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
I'll try that. Let you know how it works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML to Servlet?
 
Similar Threads
Servlet becomming slow
Servlet becomming slow
Servlet Initialization Parameters
form data
HTTP POST-Method not supported by this URL.