Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Controller in MVC architecture

 
Srinivasan Madhavan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
 
Deb Sadhukhan
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic