D
Dobedani
Dear All,
Apparently, request.getParameterMap() is the way - since about 3 years
- to approach the parameters coming in via the querystring in the
context of a servlet or Java Server Page. Looks quite powerful, but
unfortunately, I don't understand how to use the result of this
function, which is of class Map.
I have already tried a number of things. I tried to use methods
keySet() and entrySet() to obtain a set of all the keys after which I
used iterators to go through and get the key-value pairs, e.g.:
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Map.Entry" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Iterator" %>
<html>
....
<%
Map params = request.getParameterMap();
Set set = params.entrySet();
Iterator iter = set.iterator();
while (iter.hasNext()) {
Entry n = (Entry) iter.next();
out.println(n.getKey().toString(), n.getValue().toString());
}
%>
....
</html>
The problem is that I do not get the strings back which I included in
the querystring. Instead I get values like: [Ljava.lang.String;@10f
which are of no use to me. I rather like sets of class Attributes. At
least, that class has a method getValue(key)!
What am I doing wrong??? Please help!!! TIA
Dobedani
Wageningen
The Netherlands
Apparently, request.getParameterMap() is the way - since about 3 years
- to approach the parameters coming in via the querystring in the
context of a servlet or Java Server Page. Looks quite powerful, but
unfortunately, I don't understand how to use the result of this
function, which is of class Map.
I have already tried a number of things. I tried to use methods
keySet() and entrySet() to obtain a set of all the keys after which I
used iterators to go through and get the key-value pairs, e.g.:
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Map.Entry" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Iterator" %>
<html>
....
<%
Map params = request.getParameterMap();
Set set = params.entrySet();
Iterator iter = set.iterator();
while (iter.hasNext()) {
Entry n = (Entry) iter.next();
out.println(n.getKey().toString(), n.getValue().toString());
}
%>
....
</html>
The problem is that I do not get the strings back which I included in
the querystring. Instead I get values like: [Ljava.lang.String;@10f
which are of no use to me. I rather like sets of class Attributes. At
least, that class has a method getValue(key)!
What am I doing wrong??? Please help!!! TIA
Dobedani
Wageningen
The Netherlands