Salesforce Certified B2C Commerce Developer free question 8 / 10 · Domain 4: Application Development
A developer wants a controller to render a single Page Designer component on its own, without the page that holds it. What does the guide say about this?
- Components cannot be rendered separately, and a page renders with its components
- A component renders on its own when its ID is passed to PageMgr.renderPage
- A component renders on its own when the controller calls its script file
- A component renders on its own when its region sets max_components to 1
Show the answer and explanation
Answer: A
Why this is correct
The Page Designer development page says to use the dw.experience.PageMgr API to render pages. Pages are rendered together with their components, and components can’t be rendered separately. The call PageMgr.renderPage(cid, parameters) belongs in a controller, for example in the Page-Show controller to take advantage of SEO URL features.
Why the other options are wrong
"A component renders on its own when its ID is passed to PageMgr.renderPage" … PageMgr.renderPage takes the ID of a page. The guide says pages are rendered together with their components and components can’t be rendered separately.
"A component renders on its own when the controller calls its script file" … Pages are rendered together with their components through the dw.experience.PageMgr API. The script file of a component is not called by a controller.
"A component renders on its own when its region sets max_components to 1" … The max_components value restricts the number of components rendered in a region at a time. It does not render a component outside its page.
Key points
Page rendering occurs within a nested remote include. Parameters can be passed to the rendering process as a JSON string.