Forums Register Login

RequestDispatch Forward and Include

+Pie Number of slices to send: Send
I am unit testing (with the help of Cactus framework) my servlet which contains the line RequestDispatcher.forward(..). In short, I need to manually instantiates my servlet and calls its doGet() with the request/response provided by the framework and verify the required attributes are put in the request when the servlet returns.

However, that comes to the question of what RequestDispatcher.forward() would do to my execution flow. Normally, we're not expected to put in any code after forward(). But in unit testing, our verification would be placed after the servlet call. I checked the API & servlet spec. There is nothing about the execution flow after forward() call. Can anyone clarify on this? Thanks a lot.
+Pie Number of slices to send: Send
I think this goes beyong the scope of unit testing. It is the container's responsability to leave the request parameters after the forward. If you want to check that parameters are in the request, do it before the forward.
We must storm this mad man's lab and destroy his villanous bomb! Are you with me tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 600 times.
Similar Threads
Forwarding requests between servlets
Page history
Request Attributes
calling one servlet from another servlet
Cactus Problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:24:21.