4: Developing applications >
4.2: Building Web applications >
4.2.1: Developing servlets >
4.2.1.3: Servlet content, examples, and samples >
4.2.1.3.3: Using page lists to avoid hard coding URLs >
4.2.1.3.3.1: Obtaining and using servlet XML configuration files (.servlet files) >
4.2.1.3.3.1.1: Extending PageListServlet >
4.2.1.3.3.1.1.1: Example: Extending PageListServlet

4.2.1.3.3.1.1.1: Example: Extending PageListServlet

SimplePageListServlet is an example of a servlet that extends the PageListServlet class and uses its callPage() method to invoke a JSP:

public class SimplePageListServlet extends com.ibm.servlet.PageListServlet {
public void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
try{
setRequestAttribute("testVar", "test value", req);
setRequestAttribute("otherVar", "other value", req);

String pageName = getPageNameFromRequest(req);
callPage(pageName, req, resp);
}
catch(Exception e){
handleError(req, resp, e);
}
}
}

Go to previous article: Extending PageListServlet Go to next article: Using XMLServletConfig to create .servlet configuration files

 

 
Go to previous article: Extending PageListServlet Go to next article: Using XMLServletConfig to create .servlet configuration files