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.
<servlet>
<servlet-name>imageServlet</servlet-name>
<servlet-class>com.myapp.system.ImageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>imageServlet</servlet-name>
<url-pattern>/image/*</url-pattern>
</servlet-mapping>
When I call the servlet it looks like this
<p:graphicImage value="image?app=avatar?id=#{bean.imgId}" />
In my servlet I get the parameters like so
String id = request.getParameter("id");
String app = request.getParameter("app");
If I output the app string it displays this
avatar?id=166
How can I allow the servlet url-patter to take in two values and be able to parse them using the getParameter method. Thanks.
The format for encoding URL parameters is to separate key-value pairs with an ampersand (
&):