Hi all,
I require to move from one
servlet to other servlet based on certain criteria. I came across two ways to do this:
1. Using URL
http://.../servlet/<package.name>.ServletName
2. Using RequestDispatcher
The first way of accessing a servlet is not recommended because of certain issues like security, managablity etc.
The second way of using RequestDispatcher is preferred. However, to access the servlet using this method, it is required to use the
url pattern of the servlet which has to be accessed (if I'm not wrong) in the
web.xml file. There is a problem with this, as the developer should decide the url pattern initially. By doing this the deployer has to make sure he maintains the same url pattern; failing to which the code has to be changed to alter the url pattern.
Now, my question is, is there any other better way for enabling servlet-to-servlet communication, rather than avoiding it?