I have a jsp file that contains all the html and javascript that I want for my website.
Is it possible for me to create a servlet and then have the servlet reference the jsp file (instead of putting all the html into the servlet)?
Maybe something along the lines of:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//initiate jsp file
}
All you need is as below :
ServletContext context = getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher("/thankYou.jsp");
dispatcher.forward(request,response);
or else you can set welcome-file
also as jsp page in your web.xml
if you dont need to instantiate Servlet first.