Movatterモバイル変換


[0]ホーム

URL:


BloomreachBloomreach
Hippo CMS

Bloomreach Documentation version

Bloomreach.com

This article covers a Bloomreach Experience Manager version 13. There's anupdated version available that covers our most recent release.

Poll Component Developer Guide - Rendering

Rendering the Poll

Available Poll Data

In order to be able to create rendering code (JSP or Freemarker), you have to know what data is available for rendering. The following table describes this.

FieldDescription
pollDocumentRefers to the root-level HST bean, representing the processed poll document. For poll documents of the plugin-supplied type, the bean is implemented byorg.onehippo.forge.poll.contentbean.PollDocument. If no poll document is available, this field isnull and no further rendering should be attempted. While custom poll documents may provide extra properties, the plugin-supplied document type only exposes thepoll field:
pollDocument.pollRefers to the HST bean representing the poll compound. This bean is implemented byorg.onehippo.forge.poll.contentbean.compound.Poll.
pollDocument.poll.textString field containing the value of thetext attribute of the poll compound.
pollDocument.poll.introductionString field containing the value of theintroduction attribute of the poll compound.
pollDocument.poll.optionsList of HST beans specifying the options available for this poll document. Each option is implemented byorg.onehippo.forge.poll.contentbean.compound.Option.
pollDocument.poll.options[].valueString field containing the value of thevalue attribute of the selected option.
pollDocument.poll.options[].labelString field containing the value of thelabel attribute of the selected option.
voteSuccessBoolean indicating, when a voting attempt was made, if the attempt was successful or not. If no voting attempt was made, the field is not available
optionString containing the option previously voted on. May not be available.
pollVotesRefers to a Java bean of type org.onehippo.forge.poll.bean.PollVotesBean which contains the votes data pertaining to thepollDocument. Just like the poll compound, this bean provides votes data asoptions:
pollVotes.optionsList of beans representing the options available for the poll document
pollVotes.options[].valueSame as pollDocument.poll.options[].value
pollVotes.options[].labelSame as pollDocument.poll.options[].label
pollVotes.options[].votesCountLong integer indicating the number of votes cast onto this option.
pollVotes.options[].votesPercentageLong integer indicating the (rounded-off) percentage of this option relative to all votes for this document.

Creating a Template

Your poll is rendered using a JSP or Freemarker template. The poll plugin comes with a Freemarker template illustrating the rendering of the attributes of the poll component. You can find the code in the repository underhst:[your_project]/hst:configurations/hst:default/hst:templates/poll.component.ftl@hst:script.

If necessary, customize this code and make sure it is part of yoursite.war.

If you use your customized code, refer to it by configuring a new template under/hst:[your_project]/hst:configurations/[your_project]/hst:templates, pointing the component'shst:renderpath attribute to your template.

If you use the default Freemarker template provided by the poll plug-in, a template calledpoll.component.ftl is available to be used by your component.

Did you find this page helpful?
How could this documentation serve you better?
Cheers!
On this page
    Did you find this page helpful?
    How could this documentation serve you better?
    Cheers!

    [8]ページ先頭

    ©2009-2025 Movatter.jp