Hello Durga, this is a good question because it is fundamental.
> My doubt is regarding the controlling and the general flow.
> Its necessary to have just one servlet controller that takes the request
> parameters from one jsp and delegate it to some other jsp.
Controller concept is to handle the user's Interactions with the page. Form submission, query/ edit and navigation, as well as simply requesting pages.
Different areas of data (News, Searches, Edit forms, Static Content) would have different Controllers requirements. Implementation could be under any name or place but you what a class is for.
> But when there are thousands of jsp's and there is only one controller
I would refer you to the Spring framework which uses meaningful names for meaningful concepts. 'Handler' or 'Interceptor' may be used as early stage of request handling to handle generic Login, Menus, templating etc before delegating to the Controller which handles the user's major task.
If there are thousands of jsps then they are 1000x similar templated content and similar behaviour. Or there are multiple Controllers.
> then how does the servlet controller knows from which jsp the request is
> comming and which page to render next.
Let's take a sidestep: Meaningful designs might have StaticPageController, [customer data] SearchController, [customer data] EditController, ForumPageController, IntroPageController, ...
Here's a tricky one, for knowing where you are on the Web: what about the URL path?
As for coming or going, that's also a good question. The answer is fundamental: it depends on whether you need to do anything or not. If your apoplication is passive, let HTML do the navigation for you; you controller only has to return the right static content.
If your application has to take some action, then the controller has to handle this and flow or redirect onwards. You guessed it, form submissions and interaction.
So if you structure your data areas to be requested into paths, eg /cust/search, /cust/edit, /order/search etc, and implement Controller functionality sensibly for these, you'll probably have a good idea of where you are and what you're doing...
as well as a fairly sensible software design.
As to exactly which customer, search criteria, selection etc you are working with -- nobody's found a better use for URL parameters. For each page when you generate action and navigation hotlinks in the JSP you output the data to parameterize the request.
Lastly, paths are useful for document areas. The machine uses paths in the file system so /docs/* might go to DocumentController which sources content from eg. the file system.
Anyway, check out the Spring framework. I recommend Tomcat/ Spring/ JDO as an effective combination. You want to understand clean and direct application code to get the job done. Hope this helps,
Regards,
Thomas Whitmore
www.powermapjdo.com