Show Menu


Java Use-API
JavaScript Use-API
  • 更快速
  • 可使用除錯程式進行檢查
  • 易於單元測試
  • 可由前端開發人員修改
  • 位於元件中,使元件的檢視邏輯與其對應的範本保持接近
  • 無法由前端開發人員修改
  • 較慢
  • no debugger (yet)
  • harder to unit-test
For page components, it is recommended to use a mixed model, where all model logic is located in Java, providing clear APIs that are agnostic to anything that happens in the view (i.e. within the components). AEM comes with great default models like the Page or the Resource API that should be able to cover most cases.
All view logic that is specific to a component should be placed within that component as JavaScript, because it belongs to that component.