Guest User

Untitled

a guest
Oct 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. public class ManageClients extends HttpServlet{
  2.  
  3. @Override
  4. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  5.  
  6. String[] clientTypes = ClientTypes();
  7. Collection<String> data = new ArrayList<>();
  8. String formattedData;
  9. HttpSession session = request.getSession();
  10. //Get the column data for each type
  11. String[] amountOfClients = request.getParameterValues("data[]");
  12. int amountOfDayEnds = Integer.parseInt(session.getAttribute("amountOfDayEnds").toString());
  13.  
  14.  
  15. for (int i=0;i<clientTypes.length;i++) {
  16.  
  17. //Get the dates and correspondent input
  18. for (int k=0;k<amountOfDayEnds;k++) {
  19. //Format the string
  20. formattedData = k+1 + " - " + clientTypes[i] + " # " + amountOfClients[k];
  21. data.add(formattedData);
  22. }
  23. }
  24. session.setAttribute("EnvironmentData",data);
  25. }
  26.  
  27. public static String[] ClientTypes() {
  28. final String[] clientTypes = {"Individual","Corporation"};
  29. return clientTypes;
  30. }
Add Comment
Please, Sign In to add comment