/** * Servlet to illustrate use of beans and custom tag. * In this Servlet we create a bean and store it in * the request scope with the key "resultBean" * The request is then forwarded to a JSP page. * This page will use a custom tag that will get this * bean from the request scope and use a method on this * bean to generate HTML content. * * @author Nauman Chaudhry */ package classExamples; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import cs4208.beans.TestBean; public class CustomTagServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Create a bean TestBean resBean = new TestBean(); // Store the bean on request request.setAttribute("resultBean", resBean); // Dispatch the request to the JSP page RequestDispatcher dispatcher = request.getRequestDispatcher( "/customTagTestor.jsp"); dispatcher.forward(request, response); } }