Jetty JSP

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Jetty JSP

Brenna19
Hi,

This is my requirement - The process flow should be from Jetty to Servlet to JSP.
When I hit a url, my servlet should be called, which adds some params and opens a jsp in the browser.

Snippets of code here:
  //url : http://localhost:4122/jsp/admin
  WebAppContext webapp= new WebAppContext();
  webapp.setContextPath("/jsp");
  webapp.setWar("src/main/webapps/test");
  webapp.addServlet("TestServlet", "/admin/*");
  server.addHandler(webapp);
  server.start();
  server.join();

// TestServlet
   protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
             request.setAttribute("Name", "Billy");
    request.getRequestDispatcher("/HelloWorld.jsp").include(request, response);
    }

When I hit the url, it shows a blank page and there is no error/exception.
Any Help would be much appreciated!

Thank you.
Brenna