title: Hyperlink to servlet
body: <p>I have a java program that accesses a database with columns <code>ID, FirstName, LastName, Age</code>. (ID is the primary key, no two elements in the database have the same ID).</p>
  
  <p>In part of my program, a <code>Servlet</code> displays all of the elements in the database in a HTML table, except it only displays the ID and <code>FirstName</code>-fields. I have set up the ID field to be a hyperlink. So far so good.</p>
  
  <p>However, when the user clicks the ID hyperlink, I want this to forward them to a <code>Servlet</code> that displays <code>ID, FirstName, LastName, and Age</code> of the particular element they clicked on. So, let's say this is the table the HTML displays: </p>
  
  <ul>
  <li>Row 1: <code>[ID=1, FirstName=Jim]</code>, and</li>
  <li>Row 2: <code>[ID=2, FirstName=Joe]</code>.</li>
  </ul>
  
  <p>The actual data in the database is: </p>
  
  <ul>
  <li>Row 1: <code>[ID=1, FirstName=Jim, LastName=Smith, Age=25]</code>, and</li>
  <li>Row 2: <code>[ID=2, FirstName=Joe, LastName=Chang, Age=37]</code>.</li>
  </ul>
  
  <p>In the display table ID fields are hyperlinks for both Jim and Joe. This is all working so far.</p>
  
  <p>However, when I actually click one, it doesn't do what I want. Say I clicked on the hyperlinked 2, in front of Joe. Then I would expect it to display 2, Joe, Chang, 37, from the database, but I don't know how to do this.</p>
  
  <p>All the hyperlink is doing is forwarding the request to a <code>Servlet</code>, whose URL pattern is <code>DisplayPerson.do</code>, and attempting to get the ID parameter so it can get the element with that ID and display all of the other fields.</p>
  
  <p>I know how to display all the fields IF I can get the ID parameter- but I don't know how to set or send different ID parameters when each different hyperlinked ID is clicked, they all just forward to the same <code>Servlet</code> but this doesn't know which one the request was sent from.</p>
  
  <p>I would also like to avoid URL appending if possible, but if that's the only way to do it then I could do that. Can someone explain how this can be done (or even if)?</p>