我在我的项目中使用hippo cms,它有一个文档类型用于存储联系我们的详细信息。在我的CMS资源库中有9个联系我们文档(全部已发布),但在我的应用程序中只有5个正在显示,其他4个没有显示。 如果我更改文档的显示顺序,则不可见文档显示在应用程序上,但其他文档将消失。 在jsp或CMS中没有使用限制。 谁能告诉我为什么会这样呢?
<sv:node xmlns:sv="http://www.jcp.org/jcr/sv/1.0" sv:name="home">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hst:component</sv:value>
</sv:property>
<sv:property sv:name="hst:referencecomponent" sv:type="String">
<sv:value>hst:pages/standard</sv:value>
</sv:property>
<sv:node sv:name="main">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hst:component</sv:value>
</sv:property>
<sv:node sv:name="content">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hst:component</sv:value>
</sv:property>
<sv:property sv:name="hst:referencecomponent" sv:type="String">
<sv:value>hst:components/content</sv:value>
</sv:property>
<sv:property sv:name="hst:template" sv:type="String">
<sv:value>home.main.content</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="lists">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hst:containercomponent</sv:value>
</sv:property>
<sv:property sv:name="hst:componentclassname" sv:type="String">
<sv:value>org.hippoecm.hst.pagecomposer.builtin.components.StandardContainerComponent</sv:value>
</sv:property>
<sv:property sv:name="hst:xtype" sv:type="String">
<sv:value>HST.UnorderedList</sv:value>
</sv:property>
<sv:node sv:name="contacts">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hst:containeritemcomponent</sv:value>
</sv:property>
<sv:property sv:name="hst:componentclassname" sv:type="String">
<sv:value>org.rf.online.components.Contacts</sv:value>
</sv:property>
<sv:property sv:name="hst:iconpath" sv:type="String">
<sv:value>images/catalog-list.png</sv:value>
</sv:property>
<sv:property sv:name="hst:label" sv:type="String">
<sv:value>Contacts</sv:value>
</sv:property>
<sv:property sv:name="hst:parameternames" sv:type="String" sv:multiple="true">
<sv:value>title</sv:value>
<sv:value>scope</sv:value>
<sv:value>docType</sv:value>
<sv:value>sortBy</sv:value>
<sv:value>backgroundColor</sv:value>
<sv:value>sortOrder</sv:value>
<sv:value>secondSortBy</sv:value>
<sv:value>secondSortOrder</sv:value>
<sv:value>pageSize</sv:value>
</sv:property>
<sv:property sv:name="hst:parametervalues" sv:type="String" sv:multiple="true">
<sv:value>contact</sv:value>
<sv:value>/</sv:value>
<sv:value>rfonline:contactsdocument</sv:value>
<sv:value>rfonline:contactRegionOrder</sv:value>
<sv:value>light</sv:value>
<sv:value>ascending</sv:value>
<sv:value>rfonline:contactOrder</sv:value>
<sv:value>ascending</sv:value>
<sv:value>21</sv:value>
</sv:property>
<sv:property sv:name="hst:template" sv:type="String">
<sv:value>standard.main.contacts</sv:value>
</sv:property>
<sv:property sv:name="hst:xtype" sv:type="String">
<sv:value>HST.Item</sv:value>
</sv:property>
</sv:node>
</sv:node>
</sv:node>
</sv:node>
这是我的home.xml,其pageSize属性设置为21.我将它增加到50,但仍然没有显示总文档。
在Contacts.java中不使用pageSize属性,但Contacts类扩展了使用pageSize的BaseComponent类。 以下是Contacts和BaseComponent类的代码片段。
@ParametersInfo(type = ContactsInfo.class)
public class Contacts extends BaseComponent{
//code
}
public abstract class BaseComponent extends BaseHstComponent {
public static final Logger log = LoggerFactory.getLogger(BaseComponent.class);
protected void createAndExecuteSearch(final HstRequest request, final GeneralParamsInfo info, final HippoBean scope, final Map<String,Object> queryMap) throws HstComponentException {
int pageSize = info.getPageSize();
if (pageSize == 0) {
log.warn("Empty pageSize or set to null. This is not a valid size. Use default size");
}
try {
HstQuery hstQuery = getQueryManager(request).createQuery(scope, filterClass, true);
hstQuery.setLimit(pageSize);
hstQuery.setOffset(pageSize * (crPage - 1));
if (sortBy != null && !"".equals(sortBy)) {
if (sortOrder == null || "".equals(sortOrder)||"descending".equals(sortOrder)) {
hstQuery.addOrderByDescending(sortBy);
} else {
hstQuery.addOrderByAscending(sortBy);
}
}
String querys = null;
}
final Object attribute = request.getAttribute("isPageableCollection");
final Boolean isPageableCollection = (Boolean) (attribute != null ? attribute : false);
if (info instanceof PageableListInfo && ((PageableListInfo) info).isPagesVisible()) {
if (result.getTotalSize() > pageSize) {
List<Integer> pages = new ArrayList<Integer>();
int numberOfPages = result.getTotalSize() / pageSize;
if (result.getTotalSize() % pageSize != 0) {
numberOfPages++;
}
for (int i = 0; i < numberOfPages; i++) {
pages.add(i + 1);
}
request.setAttribute("pages", pages);
}
}
} catch (QueryException e) {
throw new HstComponentException("Exception occured during creation or execution of HstQuery. ", e);
}
}
}
这是我的ContactInfo界面: -
public interface ContactsInfo extends GeneralParamsInfo {
@Parameter(name = "scope", defaultValue="/", displayName = "Scope")
@DocumentLink(docType = "rfonline:contactsdocument")
String getScope();
@Override
@Parameter(name = "docType", displayName = "Document Type", defaultValue="rfonline:contactsdocument")
String getDocType();
@Parameter(name = "backgroundColor", defaultValue="light", displayName = "Background Color")
String getBackgroundColor();
}
答案 0 :(得分:1)
可能有一个&#34; pageSize&#34;组件参数设置为5。 请检查您的组件是否使用@ParametersInfo注释,指向具有默认页面大小值的参数信息界面,或者您的组件在搜索时读取/设置页面大小值。