Creating cq5 component with a dialog (configurable component) - Part 2

By | 07:42 1 comment
This post is a sequel to the post Creating cq5 component with a dialog (configurable component) - Part 1

Now that we have our dialog ready lets see how the data can be fetched in our jsp and displayed.

The data configured by the author are stored as properties of a node. Since cq5 is built on sling it treats everything as a content and content has resource. So instead of using the node,we can use resource to fetch the property. The properties are stored as a value map. We'll have to fetch the property from the value map.

CQ5 exposes valueMap of the components' resource as "properties" object (it is done in one of the files included in global.jsp . Make it a point to include global.jsp in every jsp). The valueMap has get() method which will return the value.



The jsp of our blogPost component will be like this

That's it, our configurable blog component is done.

cq:text tag is a convenience tag that is brilliant to output formatted HTML. It comes with a lot of brilliant things like a place holder, tagClass etc... The best part is no null pointers in case you are not using jstl. .

NOTE: You can use the properties object in JSTL too. Ex: ${properties.title} instead of <%=properties.get("title","configure title")%>



1 comment: Leave Your Comments

  1. Harrah's Cherokee Casino Resort debuts casino-style sports
    This $550 경산 출장마사지 million project 속초 출장샵 marks the first expansion in a major expansion in the casino resort's history. It also 제주도 출장마사지 marks the first casino in 영천 출장안마 North Carolina 김포 출장샵

    ReplyDelete