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.
Related videos on Youtube
Author by
JAVAGeek
Updated on June 17, 2022Comments
-
JAVAGeek about 2 years
Is this possible?
RequestDispatcher rd = request.getRequestDispatcher("index.html"); rd.forward(request, response);
-
verisimilitude about 12 yearsWould you like
forward
the control to another resource typically a web component? If yes, then use aRequestDispatcher.forward()
. If you like to redirect to a completely new resource, use asendRedirect()
. Hoping that you're clear about the differences between them. stackoverflow.com/questions/2047122/…
-