title: Passing a map or objects from jsp to a servlet
body: <p>I have an application which passes a map from a servlet to a jsp. In the jsp,i displays the map and provides an option to delete or edit the values pf the map.But, after changing the values, how to send the the map back to another servlet,where it recieves the map.</p>
  
  <p>Suppose, i have a servet "servletA" which passes a map to a jsp as follows:</p>
  
  <pre><code>public int Id=11111;
  Map&lt;String,String&gt; configParamsMap=new HashMap&lt;String,String&gt;(size);
      configParamsMap.put("1", "arg1");
      configParamsMap.put("2", "arg2");
      configParamsMap.put("3", "arg3");
      configParamsMap.put("4", "arg4");
      //
      System.out.println("parameters passing to the jsp:: appId"+appId+"::configId"+configId);
      request.setAttribute("configParamsMap", configParamsMap);
      request.setAttribute("Id", Id);
  
  
      RequestDispatcher rd = request.getRequestDispatcher("/JSP/display.jsp");
      rd.forward(request, response);
  </code></pre>
  
  <p>in the jsp, i can do delete or edit the values. i am doing delete as follows and passing the parameters</p>
  
  <pre><code>&lt;c:forEach var="configParams" items="${configParamsMap}"&gt;
      &lt;!--  KEY: ${configParams.key}  - VALUE: ${configParams.value} --&gt;
  
      &lt;tr&gt;
          &lt;td&gt;
          &lt;c:out value="${configParams.key}" /&gt;
          &lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="" value="${configParams.value}" /&gt;&lt;/td&gt;
  
      &lt;/tr&gt;
  &lt;/c:forEach&gt;
  &lt;/table&gt;
  &lt;form action="sevletB?action=Delete" method="post"&gt;&lt;input
  type="submit" value="Delete"&gt;&lt;/input&gt;
  &lt;input type="hidden" name="Id" value="${Id}"&gt;&lt;/input&gt;   
  &lt;/form&gt;
  </code></pre>
  
  <p>My problem is that how to pass the map back to another servlet "servletB" as i have done to parameter "id" . This map should be the one, where a user has either edited some values i.e. the present status of the map in the jsp.</p>