I have a controller associated with a jsp page. I understand that on any event( submit) from the jsp page, the controller is called. Will the controller come into play before the page loads also?
Thanks in advance, Srini
posted 10 years ago
Typically an application built on MVC architecture is started by invoking a servlet, and that could be your controller.
Think in this way, when a jsp is rendered, it will essentially use several beans and attributes etc. to build the page. For example, a dropdown on the page could be dynamic, for which items could come from a List stored in request. Now, the task of building the list might have been done by a controller invoked earlier. So, here answer to your question will be YES.
On the other hand, if you are rendering a page which does not have any dynamic content or all dynamic contents are available in session, then NO, the controller corresponding to the jsp will not be invoked when jsp is rendered.
True answer is IT DEPENDS on business need.
_ __ _ __ _ __ _<br />SCJP 1.4 (95%) | SCWCD 1.4 (79%)<br />Artificial intelligence is no match for natural stupidity.