3

Is this possible?

RequestDispatcher rd = request.getRequestDispatcher("index.html");
rd.forward(request, response);
informatik01
  • 16,038
  • 10
  • 74
  • 104
JAVAGeek
  • 2,674
  • 8
  • 32
  • 52
  • @Thilo can't we use responce.sendRedirect("index.html") instead..I mean which would be better option? – JAVAGeek Jun 27 '12 at 09:57
  • they should both work. What is better depends on if you want to redirect or not. For example, the URL would change if you do. – Thilo Jun 27 '12 at 09:58
  • 2
    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. http://stackoverflow.com/questions/2047122/requestdispatcher-interface-vs-sendredirect – verisimilitude Jun 27 '12 at 10:04

2 Answers2

5

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

Pramod Kumar
  • 7,914
  • 5
  • 28
  • 37
2

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

Ramesh PVK
  • 15,200
  • 2
  • 46
  • 50