Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package murach.cart;
- import java.io.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import java.util.ArrayList;
- import murach.data.ProductIO;
- import murach.business.Product;
- public class ProductsServlet extends HttpServlet {
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- HttpSession session = request.getSession();
- String path = getServletContext().getRealPath("/WEB-INF/products.txt");
- ArrayList<Product> products = ProductIO.getProducts(path);
- session.setAttribute("products", products);
- String url = "/index.jsp";
- getServletContext()
- .getRequestDispatcher(url)
- .forward(request, response);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement