title: Can you call a servlet with a link?
body: <p>Can you call a servlet with a link? For example</p>
  
  <pre><code>&lt;a href="/servletName"&gt;link text&lt;/a&gt;
  </code></pre>
  
  <p>And possibly pass parameters to the request object by adding them to the querystring.</p>
  
  <p>If not, I have seen this kind of thing:</p>
  
  <pre><code>RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(/MyServlet); 
  dispatcher.include(request,response); 
  </code></pre>
  
  <p>But how would I trigger this? For example if it was JavaScript code I could put it within a jQuery click function, or if this was a servlet I would put it into a method.</p>
  
  <p>But how do I call this code from within a JSP. As far as I know you can't call Java code with JavaScript events.</p>