title: getting int variable value from another servlet
body: <p>I have a question regarding calling an int number from another servlet. Lets say I have 2 servlets. Servlet 1 gives me a variable number from a database. Im my servlet 2 I would like to have a function that can print out this variable. How can I do that?</p>
  
  <p>The servlets interact with that I get a return value from the database called allay_hours_sum. That is a number, fx 35.5. In servlet 2 I would like to have a function where I can call this number. I have not made servlet 2 yet.</p>
  
  <p>This is the code where I retrieve a number from the MySQL database:</p>
  
  <pre><code>String sql = "SELECT *, (Day_hours + (Day_minutes / 60)) AS Allday_hours FROM Workdata "; //WHERE startDate='?' AND endDate='?' 
              PreparedStatement pst = connection.prepareStatement(sql);
  
              ResultSet rs = pst.executeQuery(sql);
  
              float Allday_hours_sum = 0;
                  while (rs.next()){                                      
                      Allday_hours_sum += rs.getFloat("Allday_hours"); 
  
                  }   
                  res.setContentType("text/html;charset=UTF-8");          
                  res.getWriter().print(Allday_hours_sum);
  </code></pre>
  
  <p>Best Regards
  Mads</p>