File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Controller in MVC architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Controller in MVC architecture" Watch "Controller in MVC architecture" New topic

Controller in MVC architecture

Srinivasan Madhavan

Joined: Sep 21, 2004
Posts: 10

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,
Deb Sadhukhan
Ranch Hand

Joined: Nov 05, 2003
Posts: 67
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.
I agree. Here's the link:
subject: Controller in MVC architecture
It's not a secret anymore!