Suppose I am running a JSP/Servlet driven website. A user POSTs data to the root directory and I have a servlet (Index.java
) that handles the path /
. What I want this servlet to do is look at some of the data in the request and determine which of a second level of servlets should handle it. When it decides which second level servlet will handle the request, it forward()
s to that second level servlet.
Now my problem is, what happens if a third level of servlet is needed? The second level of servlets cannot forward()
to the third level because the dispatcher claims the response has already been committed.
Visually:
Index.java
+SecondLevelA.java
+SecondLevelB.java
\SecondLevelC.java
\ThirdLevelC.java
The SecondLevelC.java
cannot forward to the third level. I also cannot redirect because I will lose the POST prameters in the redirect. POST is required because the data is too large for a GET query.