/Users/lyon/j4p/src/net/server/servlets/servletToJsp.java

1    package net.server.servlets; 
2     
3    import javax.servlet.http.HttpServlet; 
4    import javax.servlet.http.HttpServletRequest; 
5    import javax.servlet.http.HttpServletResponse; 
6     
7    public class servletToJsp extends HttpServlet { 
8     
9        public void doGet(HttpServletRequest request, 
10                         HttpServletResponse response) { 
11    
12           try { 
13               // Set the attribute and Forward to hello.jsp 
14               request.setAttribute("servletName", "servletToJsp"); 
15               getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request, response); 
16           } catch (Exception ex) { 
17               ex.printStackTrace(); 
18           } 
19       } 
20   } 
21