0

I need to get the content of a jsp page from a servlet without redirect or forward, like a file for security issues, I'll process the HTML and write the new generated HTML in the servlet response. How can I do that?

An example of what I'm trying to do:

if (request.getParameter("pageName").equals("index")) {
    //get index.jsp content and process it...
}
Luiggi Mendoza
  • 83,472
  • 15
  • 149
  • 315
IbrahimAsad
  • 506
  • 1
  • 5
  • 16

1 Answers1

0

You can't do that in a servlet, but you could do it in a Filter, in the doFilter method. You would need to provide a wrapper around the response object, something like what they do here.

Andres Olarte
  • 4,300
  • 3
  • 22
  • 45