Components

Model & View

跟 MVC 最大的不同在于 Controller 的纯净性:即 Content 作为 Resource 总是拥有某种实体,而 Sling 提供的就是一种 Scripting Solution

via The Basics:

Using Sling, the type of content to be rendered is not the first processing consideration. Instead the main consideration is whether the URL resolves to a content object for which a script can then be found to perform the rendering. This provides excellent support for web content authors to build pages which are easily customized to their requirements. The advantages of this flexibility are apparent in applications with a wide range of different content elements, or when you need pages that can be easily customized. In particular, when implementing a Web Content Management system such as the WCM in the AEM solution.

Template

data-sly-use: Initializes a helper object (defined in JavaScript or Java) and exposes it through a variable.

Initialize a JavaScript object, where the source file is located in the same directory as the template. Note that the filename must be used:

<div data-sly-use.nav="navigation.js">${nav.foo}</div>

Initialize a Java class, where the source file is located in the same directory as the template. Note that the classname must be used, not the file name:

<div data-sly-use.nav="Navigation">${nav.foo}</div>

Initialize a Java class, where that class is installed as part of an OSGi bundle. Note that its fully-qualified class name must be used:

<div data-sly-use.nav="org.example.Navigation">${nav.foo}</div>

Others

Tools

结论

Ask the Experts: MVC in Adobe CQ5 | 6D Labs

实际上就是 MVC:Technically speaking, CQ5 IS MVC, just a form that seems to be unfamiliar to most MVC developers. I think that most people find CQ5's architecture "too coupled" to call it MVC. The biggest complaint I hear is that they would like the data more decoupled from the rendition. Regardless, Sling provides the controller, CRX provides the model, and JSP's/Scripts (ecma, etc) provide the view.

results matching ""

    No results matching ""