Over a million developers have joined DZone.
Gold Partner

Retrieving All Parameters to a Java Servlet

Here's a really simple code snippet for retrieving parameters to a Java servlet.

· Java Zone

    Map params = request.getParameterMap();
    Iterator i = params.keySet().iterator();

    while ( i.hasNext() )
      {
        String key = (String) i.next();
        String value = ((String[]) params.get( key ))[ 0 ];
      }


Topics:
java,java servlet

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}