Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

AEM and the MVC design pattern

Avatar

Level 10

Here is a great community article by Dan Klco that talks about the MVC design pattern and AEM. I really like this advice from the article:

"Project teams and CQ developers should attempt to follow MVC practices when developing on CQ5 by avoiding business logic in their JSPs, putting business logic in OSGi Services and leveraging new tools such as the upcoming Sling Proxy, to create the models."

I 100% agree - place as much as the heavy code in an OSGi servlet/service using Java. Then keep front end components light and have them call into OSGi services. The job of the the front end component should be to display the data - similar to Spring MVC  that use MVC controllers, data models, and views. 

To read this - see:

http://labs.sixdimensions.com/blog/2013-05-20/ask-experts-mvc-adobe-cq5/

3 Replies

Avatar

Level 3

Hi,

Do you know any best practices for applying the MVC pattern in expressions of adaptive form fields? Where can an author implement business logic that may be used among various fields within an adaptive form?

Thank you,

Urs

Avatar

Level 1

Hi Smac Donald,

I am so surprised that you used and OSGi servlet/ service using Java. I was in also in trouble with the same problem as yours.