Is there a way to make CMSParagraphComponent print variable values?
On my controller I have something like this:
model.addAttribute("isInvoiceAvailable", currentBaseStore.isAccountPaymentAvailable());
return ControllerConstants.Views.Pages.Account.PAYMENT_OPTIONS_LANDING_PAGE;
My jsp look like this:
<cms:pageSlot position="Section1" var="feature">
<c:set var="adjustPosition" value="${true}" />
<cms:component component="${feature}" element="div" class="span-24 section1Template7 cms_disp-img_slot"/>
</cms:pageSlot>
The above mentioned component is a CMSParagraphComponent.
The CMSParagraphComponent content look like this:
UPDATE CMSParagraphComponent ; $contentCV[unique=true] ; uid[unique=true] ; content[lang=$lang]
; ; paymentOptionsParagraph ; "
<h3>Payment Options</h3>
<br>
${isInvoiceAvailable}
$isInvoiceAvailable
<h4>Credit card</h4>
<br>
<p>
MasterCard, Visa
</p>"
And when the page loads it's printing the content as if there were no variables, like this:
Is there a way to make the component print some variable value from the page contenxt?
CMSParagraphComponent is rendered using CMSParagraphComponentRenderer.java, so the Expression Language is not available at the moment of the rendering, and as a result, what you are trying to do is not possible.
I think for your use case a JSPIncludeComponent is more appropriate, another solution would be to create your own component type and use a JSP file to render it.