Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ManageClients extends HttpServlet{
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- String[] clientTypes = ClientTypes();
- Collection<String> data = new ArrayList<>();
- String formattedData;
- HttpSession session = request.getSession();
- //Get the column data for each type
- String[] amountOfClients = request.getParameterValues("data[]");
- int amountOfDayEnds = Integer.parseInt(session.getAttribute("amountOfDayEnds").toString());
- for (int i=0;i<clientTypes.length;i++) {
- //Get the dates and correspondent input
- for (int k=0;k<amountOfDayEnds;k++) {
- //Format the string
- formattedData = k+1 + " - " + clientTypes[i] + " # " + amountOfClients[k];
- data.add(formattedData);
- }
- }
- session.setAttribute("EnvironmentData",data);
- }
- public static String[] ClientTypes() {
- final String[] clientTypes = {"Individual","Corporation"};
- return clientTypes;
- }
Add Comment
Please, Sign In to add comment