DispatchServlet.java Source code

Java tutorial

Introduction

Here is the source code for DispatchServlet.java

Source

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DispatchServlet extends HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

        // Forward to a display page
        String display = "/servlet/SearchView";
        RequestDispatcher dispatcher = req.getRequestDispatcher(display);
        dispatcher.forward(req, res);
    }
}