[opencms-dev] JSON output
Диканский Андрей Юрьевич
adikanskii at ncfu.ru
Thu Feb 7 08:29:55 CET 2019
Hello
I'm trying to use <cms:jsonpart> tag to provide convertations parts of my HTML to JSON.
I edited a formatter for the default resource type by adding <cms:jsonpart>.
<cms:formatter var="content">
<div class="margin-bottom-30">
<div class="headline">
<cms:jsonpart element="title"><h3 ${content.rdfa.Title}>${content.value.Title}</h3></cms:jsonpart>
</div>
<div class="row">
<c:if test="${content.value.Image.exists}">
<div class="col-md-4 col-sm-2 hidden-xs">
<div class="thumbnail-kenburn">
<div class="overflow-hidden">
<cms:img src="${content.value.Image}" scaleColor="transparent"
width="400" scaleType="0" noDim="true" cssclass="img-responsive" />
</div>
</div>
</div>
</c:if>
<div class="${content.value.Image.exists ? 'col-md-8 col-sm-10 col-xs-12' : 'col-xs-12' }">
<div ${content.rdfa.Text}><cms:jsonpart element="description">${content.value.Text}</cms:jsonpart></div>
<c:if test="${content.value.Link.exists}">
<p>
<a class="btn-u btn-u-small"
href="<cms:link>${content.value.Link}</cms:link>">${paragraph.value.Link}</a>
</p>
</c:if>
</div>
</div>
</div>
</cms:formatter>
The problem is that I have several content elements of this formater on one page, so json output contains only the last one element content.
What should I change in my jsp to provide all content of all elements to json output? Where should I make it? In template main.jsp?
Andrew Dikansky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20190207/5b813272/attachment.htm>
More information about the opencms-dev
mailing list