I want to run more than one servlets on loading a jsp.
I don't want to copy all logic to write in a single servlet as it is a bad idea. Each controller should have it's own purpose.
But can i really run more than one servlets on loading a particular jsp?
I did something in web.xml like
shashank dwivedi wrote: But can i really run more than one servlets on loading a particular jsp?
Well, no, that isn't a good idea either. As you yourself say, each controller should have its own purpose. If the controller (the one servlet) needs to execute code which is in some other servlets, then perhaps the code in the other servlets should be in a class whose methods can be called from many servlets. Or perhaps your controller servlet ought to be forwarding to the other servlet. It's hard to say without knowing your requirements. However it is possible to say that the idea of having lumps of code isolated in servlets and then needing to execute more than one of those lumps needs revising.
Joined: Mar 06, 2012
no actually i am not calling one servlet from another servlet rather what i want is something like
run controller 1 with controller1 specific logic
run controoler 2 with controller2 specific logic