title: How can I pass two values to a Java servlet?
body: <p>I am developing a JSF application which has a servlet to display binary images. I have it working with one parameter but wanted to pass two parameters. It only seems to get the first parameter. My mapping looks like this.</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;imageServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.myapp.system.ImageServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;imageServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/image/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>When I call the servlet it looks like this</p>
  
  <pre><code>&lt;p:graphicImage value="image?app=avatar?id=#{bean.imgId}" /&gt;
  </code></pre>
  
  <p>In my servlet I get the parameters like so</p>
  
  <pre><code> String id = request.getParameter("id");
   String app = request.getParameter("app");
  </code></pre>
  
  <p>If I output the app string it displays this</p>
  
  <pre><code> avatar?id=166
  </code></pre>
  
  <p>How can I allow the servlet url-patter to take in two values and be able to parse them using the getParameter method. Thanks.</p>