title: Print to printer from a jsp page. Using a button to retrieve data from a database and printing
body: <p>I'm creating this jsp page whereby I'm going to retrieve values from a database and send it to print on the printer. Like physical printers that print papers.</p>
  
  <p>For example the table employee has name, id, age, position, etc. I'm going to retrieve the name and id and print it to the printer using jsp. How do i do this?</p>
  
  <p>I would just like to know the command to use in jsp, when I want to click a button and then make it retrieve all the date I have choose and print.</p>
  
  <p>Like for example</p>
  
  <pre><code>&lt;sql:query dataSource="${snapshot}" var="result"&gt;
  SELECT * from Employees;
  &lt;/sql:query&gt;
  
  &lt;table border="1" width="100%"&gt;
      &lt;tr&gt;
           &lt;th&gt;Emp ID&lt;/th&gt;
           &lt;th&gt;First Name&lt;/th&gt;
           &lt;th&gt;Last Name&lt;/th&gt;
           &lt;th&gt;Age&lt;/th&gt;
      &lt;/tr&gt;
  
  &lt;c:forEach var="row" items="${result.rows}"&gt;
      &lt;tr&gt;
           &lt;td&gt;&lt;c:out value="${row.id}"/&gt;&lt;/td&gt;
           &lt;td&gt;&lt;c:out value="${row.first}"/&gt;&lt;/td&gt;
           &lt;td&gt;&lt;c:out value="${row.last}"/&gt;&lt;/td&gt;
           &lt;td&gt;&lt;c:out value="${row.age}"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>I know this much but the thing is i don't know how to use the printer function for JSP and some help is greatly appreciated! I would like to be able to choose the row that i want and print that row through a printer. Thanks a lot guys</p>