In the doGet() method of a servlet, how can I get parameters given within the URI? For example, if I have a servlet mapped to /getContentServlet, Then one could do a jQuery $.get() to the URI http://mysite.appspot.com/getContentServlet?var1=foo&var2=bar:
public void doGet(HttpServletRequest request, HttpServletResponse response){
// Get parameters "foo" and "bar" from the URI
}
How can I do this? Thanks!
You can achieve that by using the getParameter method: