java - why can't it allow "<%@ include file" inside a HttpServletResponse? -
this question has answer here:
ok, got jsp file & works ok
<html> <head><title>account</title></head> <body> <%@ include file="header.jsp" %> </body> </html>
now, got servlet
public void doget(httpservletrequest req, httpservletresponse resp) throws ioexception { resp.getwriter().println("<html>"+ "<head><title>account</title></head>"+ "<body>"+ "<%@ include file=\"header.jsp\" %>"+ "</body"+ "</html>" }
the servlet print out <%@ include file="header.jsp" %>
text on page & not understand <%@ include file="header.jsp" %>
.
how can let servlet print out result jsp file mentioned above?
request.getrequestdispatcher("/web-inf/header.jsp").include(request, response);
but should avoid type of situation.
Comments
Post a Comment