1

I have a servlet named "a.java" and I want to send data from a servlet to a jsp and another servlet.

I have the following code:

request.setAttribute("1",result);
RequestDispatcher d1 = request.getRequestDispatcher("b.jsp");
            d1.forward(request, response);
RequestDispatcher d2 = request.getRequestDispatcher("c.java");
            d2.forward(request, response);

"b.jsp" is working and getting data, but when I try to get some data in "c.java" with this code

        List <Products> list = (List <Products>) request.getAttribute("1");

I get a null pointer exception, can someone help me?

ChrisM
  • 1,576
  • 6
  • 18
  • 29

1 Answers1

0

Don't attempt to "send" the request to a jsp and a servlet. Instead, "send the request from the first servlet to the second servlet then from the second servlet to the JSP.

DwB
  • 37,124
  • 11
  • 56
  • 82