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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -