Servlet code.

Architect's Corner
Dynamic servlet to JSPTM page navigation

Todd Lasseigne
Listing 1. Servlet code.


public void doPost(HttpServletRequest request, HttpServletResponse
                   response) throws ServletException, IOException {
    //call the navigation service
    Navigation nav = new Navigation();
    ControllerImpl currentController = nav.createController(request);

    //invoke process on the controller and get back the next jsp and
    //dispatch the request to the JSP to handle

    RequestDispatcher dispatcher = getServletContext()
              .getRequestDispatcher("/jsp/"+
                      currentController.processRequest(request)+".jsp");
       dispatcher.forward(request, response);

About the Author

Todd Lasseigne is a Java Architect for Sun's .COM Consulting in McLean, VA. He can be contacted at todd.lasseigne@east.sun.com.

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.