I have this servlet:
public class SaveImage extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = null;
try {
out = response.getWriter();
out.println("<html>");
...
// I want to include here the content of this jsp:
// /WEB-INF/mybox.jsp
// (also, with the full context of the servlet)
...
out.println("</html>");
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Is there a problem doing it (response already committed?), how can I do this?
But you should not a servlet for outputting html like that. Just use a jsp, with either
<jsp:include />
or<%@ include file=".." %>
THANKS ozho , YOU HAVE HELPED ME TO give final shape to 2 year old pending project. Thanks. Actually to redirect the request of tomcat from sun web server 7 to application server, since the jsps are not shown in tomcat directly, technique is to use a passthrough in app.config and let the tomcat handle the requests.