0

I want to display the message with a jsp page in search container emptyResultsMessage.

Presently my code is:

<liferay-ui:search-container delta="10" emptyResultsMessage="There are no results." iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >

Now when I want to display

There are no results.+ button.jsp

in emptyResultsMessage.

In button.jsp I have a button. It has to display when emptyResultsMessage is empty.

Can any one tell me how to display it?

<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" >
VC1
  • 1,660
  • 4
  • 25
  • 42
ASR
  • 3,289
  • 3
  • 37
  • 65

1 Answers1

1

<liferay-util:buffer .../> is your friend. You don't seem to care for internationalization, so the easy approach is this: Construct the message before, then just use it:

(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" 
>

....

IMHO I'd construct the whole message on that jsp page rather than just fragments. But I'd also use proper i18n, but you get the basic idea from this.

Also, check if you need to escape the string (e.g. use <%=HtmlUtil.escape(emptyMessage)%>). I'm not sure which order the processing is done out of the top of my head (can't test currently)

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • 1
    Does the taglib liferay-ui:search-container initialize a variable with the search container ? If so, another option would be to put an empty no-results message, and check if there were results after the tag. This could be useful from a performance perspective as the "empty-results" message would be built only if needed. – Alain Dresse Oct 22 '13 at 14:32