title: java servlets : passing url variable values with spaces
body: <p>I'm building a simple java Servlet which passes categories using a URL variable into another Servlet.  </p>
  
  <p>For example, in the following code </p>
  
  <pre><code>ResultSet rs = qw.DBquery("select distinct manufacturer from Products order by manufacturer asc");
  try {
      while (rs.next()) {
          table+= "&lt;tr&gt;&lt;td&gt;&lt;a href=\"getItems?manufacturer="
                  + rs.getString("Manufacturer") + "\"&gt;"
                  + rs.getString("Manufacturer") + "&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;\n";
      }
  }
  </code></pre>
  
  <p>its output includes:</p>
  
  <pre><code>Adobe 
  Adobe Acrobat 
  IBM 
  IBM - Workstations 
  </code></pre>
  
  <p>IF I click on one, the link gets to the URL as:</p>
  
  <pre><code>http://localhost/getItems?getItems?manufacturer=Adobe%20Acrobat 
  </code></pre>
  
  <p>However, when I get the manufacturer variable and its value </p>
  
  <pre><code>String manufacturer = request.getParameter( "manufacturer" );
  ResultSet rs1 = qw.DBquery("select * from products where Manufacturer like '"
                             + manufacturer + "'");
  </code></pre>
  
  <p>the query output fails and doesn't produce anything if there are spaces in the value of manufacturer.  Any ideas or workarounds on how to convert this back?  Do I need to do some kind of urldecode?</p>
  
  <p>thanks in advance</p>