3

Is this possible?

RequestDispatcher rd = request.getRequestDispatcher("index.html");
rd.forward(request, response);
informatik01
  • 15,174
  • 9
  • 67
  • 100
JAVAGeek
  • 2,428
  • 8
  • 25
  • 49
  • @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,552
  • 5
  • 26
  • 37
2

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

Ramesh PVK
  • 14,700
  • 2
  • 43
  • 49