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

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -