Can we dispatch request to an HTML inside servlet

10,339

Solution 1

Yes. you can dispatch a request to a HTML page.

Solution 2

Yes it will work. You can get the request dispatcher for static/dynamic pages.

Share:
10,339

Related videos on Youtube

JAVAGeek
Author by

JAVAGeek

Updated on June 17, 2022

Comments

  • JAVAGeek
    JAVAGeek about 2 years

    Is this possible?

    RequestDispatcher rd = request.getRequestDispatcher("index.html");
    rd.forward(request, response);
    
    • verisimilitude
      verisimilitude about 12 years
      Would you like forward the control to another resource typically a web component? If yes, then use a RequestDispatcher.forward(). If you like to redirect to a completely new resource, use a sendRedirect(). Hoping that you're clear about the differences between them. stackoverflow.com/questions/2047122/…