Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. String client = request.getParameter("client");
  2. String address = request.getParameter("address");
  3. String date = request.getParameter("date");
  4. String product = request.getParameter("product");
  5. int quantity = Integer.parseInt(request.getParameter("quantity"));
  6. double price = Double.parseDouble(request.getParameter("price"));
  7. double subTotal = Double.parseDouble(request.getParameter("subTotal"));
  8. double gst = Double.parseDouble(request.getParameter("gst"));
  9. double total = Double.parseDouble(request.getParameter("total"));
  10.  
  11. Invoice newInvoice = new Invoice();
  12. newInvoice.setClient(client);
  13. newInvoice.setAddress(address);
  14. newInvoice.setDate(date);
  15. newInvoice.setProduct(product);
  16. newInvoice.setQuantity(quantity);
  17. newInvoice.setPrice(price);
  18. newInvoice.setSubTotal(subTotal);
  19. newInvoice.setGst(gst);
  20. newInvoice.setTotal(total);
  21.  
  22. ArrayList<Invoice> invoiceList = new ArrayList<Invoice>();
  23. invoiceList.add(newInvoice);
  24.  
  25. HttpSession session = request.getSession();
  26. if (!session.isNew()) {
  27. invoiceList = (ArrayList<Invoice>) session
  28. .getAttribute("invoiceList");
  29. } else {
  30. invoiceList = new ArrayList<Invoice>();
  31. }
  32. //invoiceList.add(newInvoice);
  33.  
  34. session.setAttribute("invoiceList", invoiceList);
  35.  
  36. RequestDispatcher rd = request
  37. .getRequestDispatcher("invoiceBinder.jsp");
  38. rd.forward(request, response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement