How do I include files in my servlet?
To achieve an include scheme in a servlet, use javax.servlet.RequestDispatcher, which takes the path of the target document in its constructor. A RequestDispatcher can be obtained from the ServletContext object (via ServletConfig) in your servlet’s init method, or from ServletRequest or HttpServletRequest in doGet or doPost. Actions: Follow-up, clarify or correct this answer. Submit a new question.