1

I have a project built using the Hippo CMS Java framework. I have created a new document type which contains a rich text field. In the document type bean I have a property of type HippoHtml:

@HippoEssentialsGenerated(internalName = "acm:abstract")
public HippoHtml getAbstract() {
    return getHippoHtml("acm:abstract");
}

Other fields of String type work fine:

@HippoEssentialsGenerated(internalName = "acm:title")
public String getTitle() {
    return getProperty("acm:title");
}

In the JSP template I can check and display simple properties like this:

<c:if test="${ not empty result.title  }">
  <h1>${ result.title }</h1>
</c:if>

However, for the HippoHtml property, I cannot get the template to recognize the field. I have tried the following:

<%--@elvariable id="result" type="org.acm.beans.CustomDocument"--%>

<c:if test="${ not empty result.abstract}">
  ${ result.abstract}
</c:if>
...
<c:if test="${ not empty result.abstract  }">
  <hst:html hippohtml="${ result.abstract }"/>
</c:if>
...
<c:if test="${ not empty result.html.abstract  }">
  <hst:html hippohtml="${ result.html.abstract }"/>
</c:if>
...
<c:if test="${ not empty result.html.content}">
  <hst:html hippohtml="${ result.html.content}"/>
</c:if>

I would like to investigate the HippoHtml type. Where in the project files (or online) can I find a class definition for org.hippoecm.hst.content.beans.standard.HippoHtml in order to see the object properties and methods?

How do I check if the document property acm:abstract has a value, then display it in my template?

mhatch
  • 4,441
  • 6
  • 36
  • 62
  • For anyone looking for the Java docs, I found them here http://javadoc.onehippo.org/hippo-cms7/7.8.x/site-toolkit/org/hippoecm/hst/content/beans/standard/HippoHtml.html – mhatch Nov 14 '17 at 19:48

1 Answers1

2

Check the code: https://code.onehippo.org/

Or the api: http://javadoc.onehippo.org/11.1/hippo-site-toolkit/

Or a more general overview page which includes the above links: https://www.onehippo.org/library/about/developer-info.html

To see if it is empty you can call

<hst:html hippohtml="${ result.abstract}" var="foo"/>

And then test if foo exists.

Jasper Floor
  • 553
  • 3
  • 6
  • I get the error " "${ result.abstract }" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${ result.abstract }] " I get this same "invalid expression" error when I try this ` – mhatch Nov 13 '17 at 21:06
  • Not sure, but maybe it doesn't like your use of abstract since that is a java keyword. I recall there being some issues with that. – Jasper Floor Nov 14 '17 at 09:10
  • That's interesting... It did the trick! I renamed the property to htmlContent and it worked. – mhatch Nov 14 '17 at 15:43