21 junio 2004

Java Skyline: Learning JavaServer Pages

Calling a JSP from a Servlet. To call a JSP from a Servlet, write the following code into the Servlet:


public void doPost(HttpServletRequest request, HttpServletResponse response) {
...
try {
String jsp2Call=/jsp/myJsp.jsp';
getServletConfig().getServletContext().getRequestDispatcher(
jsp2Call).forward(request, response); } catch (Exception e) {.....}
...
}

No hay comentarios: