On Mon, 3 Jun 2002, David Mossakowski wrote:
> How about enumerating through a request.getParameterNames and getting
> values by calling request.getParameter?
>
> come to think of it why are you first calling a _dismantling_ method and
> then manually putting the query together?
>
> how about calling request.getQueryString?
And maybe he can make use of getParameterValues somewhere in all this.
> Jay Burgess wrote:
> > I want to build a String version of my request parameters based on the
> > HashMap returned by getParameterMap(). I'm amazed that I have to do the
> > "instanceof" check below. Can someone confirm that this is the
> > requirement? (It doesn't work otherwise, and it's not clear to me why
> > getValue() doesn't just always return an array.)
> >
> > Iterator iter = req.getParameterMap().entrySet().iterator();
> > while (iter.hasNext()) {
> > Map.Entry entry = (Map.Entry) iter.next();
> > String key = (String) entry.getKey();
> > Object obj = entry.getValue();
> > if (obj instanceof String) {
> > params.append("&").append(key).append("=").append((String)
> > obj);
> > }
> > else { // else it must be an Array
> > String [] values = (String []) obj;
> > for (int i = 0; i < values.length; i++) {
> > String value = values[i];
> >
> > params.append("&").append(key).append("=").append(value);
> > }
> > }
> > }
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html