Hi, 1)How to combine two or more servlets? 2)Suppose I have developed a module in my project using servlets and jsp.And my colleques has developed thier modules.How these modules can interact with each other?
Its hard to make servlets work with each other when coded by separate developers. What you need to work on is well defined contracts between each other such as agreeing on simple POJO transfer objects and firm input/outputs of each servlet. It doesn't have to be complicated (in fact simple is better) but it has to be rock solid and clear. The clearer the contract, the easier integration will be.
Although once you go this far, you've got something that probably looks like a web/ejb service so if possible go with them since they have very well defined contracts.
Also read up on encapsulation and the blackbox methods of programming such as never allow external access to a variable (use getters/setters for all data access). This way if one of you changes your internal structure, the other is not affected.