aspose file tools
The moose likes Servlets and the fly likes servlet Map help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "servlet Map help" Watch "servlet Map help" New topic
Author

servlet Map help

Scott
Greenhorn

Joined: Sep 27, 2002
Posts: 9
It's been a while since I have written any code and I am having an issue getting back into it.

I am currently working on creating servlet to pass info from all my forms to my business logic. However, I am having an issue with getting the data. This may be a topic for a different forum, but I figured I would ask here.

I tested out the servlet with the getParameter() method, and I can get the values. However, when I try to use the java.util.Map, I get blank values.

I think the issue may be that I forgot how to use the Map object. Here is my code:

out.println("<html>");
out.println("<head>");
out.println("<title>Servlet CalCartController</title>");
out.println("</head>");
out.println("<body>");

for (int i = 0; i < formParamsMap.size(); i++) {
Map.Entry entry = (Map.Entry) keyValuePairs.next();
String key = (String)entry.getKey();
String value = (String)entry.getValue();

out.println(value);
}

out.println("<h1>Servlet CalCartController </h1>");
out.println("</body>");
out.println("</html>");


Scott<br />Never under estimate the wisdom of nature!
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26184
    
  66

Scott,

We're pleased to have you here with us here at JavaRanch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character.

Thanks,
Jeanne
Forum Sheriff


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

You can not directly iterate over map. however you can iterate over the set of Map.entry.

Example


[Servlet tutorial] [Servlet 3.0 Cook Book]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet Map help
 
Similar Threads
Servlet becomming slow
How to test my servlet
Servlet becomming slow
how to use ssi in servlets using apache web server and jserv
PersonalizeWelcome servlet question...