Liferay 如何在lifray中自定义搜索容器emptyResultsMessage?
我想在搜索容器emptyResultsMessage中显示带有jsp页面的消息 目前我的代码是:Liferay 如何在lifray中自定义搜索容器emptyResultsMessage?,liferay,portlet,liferay-6,liferay-aui,Liferay,Portlet,Liferay 6,Liferay Aui,我想在搜索容器emptyResultsMessage中显示带有jsp页面的消息 目前我的代码是: <liferay-ui:search-container delta="10" emptyResultsMessage="There are no results." iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" > 现在,当我想显示 没有结果。+button
<liferay-ui:search-container delta="10" emptyResultsMessage="There are no results." iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >
现在,当我想显示
没有结果。+button.jsp
在空的结果消息中
在button.jsp中,我有一个按钮。它必须在emptyResultsMessage为空时显示
有人能告诉我怎么显示吗
<liferay-ui:search-container delta="10" emptyResultsMessage="there were no courses found please <jsp:include page='subscribeSearch.jsp' /> with us" iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >
是你的朋友。您似乎并不关心国际化,因此最简单的方法是:先构建消息,然后使用它:
(untested pseudocode, don't expect it to work out of the box)
<liferay-util:buffer var="emptyMessage">
there were no courses found please
<liferay-util:include
page="subscribeSearch.jsp"
/>
with us
</liferay-util:buffer>
<liferay-ui:search-container delta="10"
emptyResultsMessage="<%=emptyMessage%>"
iteratorURL="<%=iteratorURL %>"
deltaConfigurable="true"
var="searchContainer"
>
....
(未经测试的伪代码,不要期望它能开箱即用)
没有找到课程,请
和我们一起
....
我想我应该在jsp页面上构建整个消息,而不仅仅是片段。但我也会使用适当的i18n,但你可以从中得到基本的想法
此外,请检查是否需要转义字符串(例如,使用
)。我不确定处理的顺序是什么(当前无法测试)taglib liferay ui:search容器是否使用搜索容器初始化变量?如果是这样,另一个选项是放置一个空的no results消息,并检查标记后面是否有结果。从性能角度来看,这可能很有用,因为只有在需要时才会生成“空结果”消息。