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 MultipleInclude extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
java.io.IOException {
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("");
out.println("");
out.println("Multiple Includes");
out.println("");
out.println("");
out.println("Hello from Level 1
");
out.println("This text is displayed at Level 1.");
RequestDispatcher dispatcher = request.getRequestDispatcher("/Level4");
dispatcher.include(request, response);
out.println("");
out.println("");
out.close();
}
}
// here is another servlet
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Level4 extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
java.io.PrintWriter out = response.getWriter();
out.println("Hello from another doGet
");
out.println("Hello from another doGet.");
}
}
/*
MultipleInclude
MultipleInclude
MultipleInclude
/MultipleInclude
Level4
Level4
Level4
/Level4
*/