// PageQuery stuff just illustrates how query/search results are obtained. They're made up of a Collection of XmlHits,
// really just value objects which are associated with Lucene Hits and which also delegate to OpenCms XML content functionality.
PageQuery pageQuery = new PageQuery("relevantArticles", requestState, pageQueryParameters, ConfigurationParameters.PRIMARY_CONTENT_LOCALE);
Collection<XmlHit> xmlHits = pageQuery.getXmlHitResults(); // easy!
// Create instance of InSituEditor; relies on CmsRequestContext, basically, though my requestState here (instantiated earlier) is of type RequestState,
// a class I use to model extra state in a typesafe way.
InSituEditor editor = new InSituEditor(requestState);
// If there are no hits, render just a 'create new' panel.
if (xmlHits.size() == 0) { // our API guarantees non-null %>
<%= editor.getEditingPanel(null, true, false, false) %><%
}
// else (because otherwise loop won't be executed) run through them all.
for (XmlHit xmlHit : xmlHits) {
// Do whatsoever you like with this hit: skip it (with 'continue') or render it, or whatever.
// To replicate contentload tag behaviour and have new/edit/delete links, use the following:%>
<%= editor.getEditingPanel(xmlHit, true, true, true) %>
<p>Hello, user! You're looking at another hit. Here's the summary:</p>
<p><%= xmlHit.getString("Teaser", true, "") %></p><%
} // loop over hits