how can I call a JSP from a servlet? I have written the following code but it doesn`t work showing an error. The following code is in servlet. req.setAttribute("person", p1); getServletContext().getRequestDispatcher("/result.jsp").forward(req,resp);
Well, in my case it did not work. I don`t know were is the mistake. Do you know where can I find an example?. I want to find an example of servlet calling a JSP.
posted 14 years ago
When you use the ServletContext interface to get a request dispatcher, the path used needs to be relative to the root of the ServletContext. So, in your app, is "/test.jsp" the correct path? How are you calling the servlet? HTH -Craig