I'm still puzzled on the usage of a RequestDispatcher.
If i have a javascript file which internally using a url to call a servlet as shown below:
var url = "../../../../FeesServlet?selectedCode="+selectedCode+"&searchNameOrCode="+searchNameOrCode
req.open("GET", url, true);
req.onreadystatechange = someFunction();
req.send(null);
Why do we need a RequestDispatcher when i can get the above job done without it? The above code still called a servlet (resource) where my business logic resides and still get a job done.
I just don't see the need for a RequestDispatcher.