Can I include a static HTML file in a servlet response using the RequestDispatcher?

Nicola Ken Barozzi

Yes. In the following code, pageName is a String containing the URL to include.

  String encodedPageName = response.encodeUrl(pageName);
  this.getServletConfig().getServletContext().getRequestDispatcher(encodedPageName).include(request, response);
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact