lunes, 29 de junio de 2009

SCWCD - notas

* A call to include will include the contents in the output and then return to complete any other output.
Compilation and output of the contents of menu.jsp followed by "Output after menu.jsp"

protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletContext sc = this.getServletContext();
RequestDispatcher dis = sc.getRequestDispatcher("/menu.jsp");
if (dis != null){
dis.include(request, response);
}
PrintWriter out = response.getWriter();
out.print("Output after menu.jsp");
}

* ServletRequest.getRequestDispatcher can take a relative URL. ServletContext.getRequestDispatcher cannot

Compilation but error at runtime
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletContext sc = this.getServletContext();
RequestDispatcher dis = sc.getRequestDispatcher("menu.jsp");
if (dis != null){
dis.include(request, response);
}
PrintWriter out = response.getWriter();
out.print("Output after menu.jsp");
}

Movie & TV Show Preview Widget

Springframework.org -

We Heart Code

Eclipse Plugin Central