title: Retrieving data from a URL using a Java Servlet (Jetty)
body: <p>I am trying to attach a parameter to a URL on a servlet: </p>
  
  <pre><code>&lt;a href="another_servlet?myVariable=&lt;%=thevariable&gt;&gt; Go to this &lt;/a&gt;
  </code></pre>
  
  <p>to be retrieved as a variable on another servlet that is called. </p>
  
  <p>which contains the following code :</p>
  
  <pre><code>// Database access with a servlet
  package ubiserv.simple;
  
  import java.io.*;
  import java.util.*;
  import javax.sql.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  public class Product extends HttpServlet {
  public void service(HttpServletRequest request,HttpServletResponse response)
          throws IOException, ServletException{
  
          response.setContentType("text/html");
          PrintWriter out = response.getWriter();
  </code></pre>
  
  <hr>
  
  <p>It seems that I can use this code to fetch what I need</p>
  
  <pre><code>request.getAttribute
  </code></pre>
  
  <p>but I have searched almost everywhere and I cannot figure out how to put it all together. Thanks in advance.</p>