我正在尝试为我的portlet创建一个搜索表单.portlet是一个地址簿应用程序,所有dao和服务构建器都使用服务构建器构建.我想给用户一个基本/高级搜索表单(就像liferay上的其他表格一样,例如控制中心的"用户和组织").
我已经实现了查看liferay源代码(6.1 GA1)的所有逻辑和页面,但搜索表单没有以任何方式显示,我将把代码放在这里.
在view.jsp中:
<%
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("jspPage", "/html/addressbookportlet/view.jsp");
pageContext.setAttribute("portletURL", portletURL);
String portletURLString = portletURL.toString();
%>
<aui:form action="<%= portletURLString %>" method="get" name="fm">
<liferay-portlet:renderURLParams varImpl="portletURL" />
<aui:input name="isSearch" type="hidden" value="true" />
<aui:input name="redirect" type="hidden" value="<%= portletURLString %>" />
<liferay-ui:search-container
searchContainer="<%= new ABContactSearch(renderRequest, portletURL) %>"
>
<%
ABContactDisplayTerms displayTerms = (ABContactDisplayTerms)searchContainer.getDisplayTerms();
ABContactSearchTerms searchTerms = (ABContactSearchTerms)searchContainer.getSearchTerms();
Long societyId = GetterUtil.getLong(searchTerms.getSocietyId(),0);
Long contactTypeId = GetterUtil.getLong(searchTerms.getContactTypeId(), 0);
Long brandId = GetterUtil.getLong(searchTerms.getBrandId(),0);
Long channelId = GetterUtil.getLong(searchTerms.getChannelId(),0);
%>
<liferay-ui:search-form
searchContainer="<%=searchContainer%>"
servletContext="<%= this.getServletConfig().getServletContext() %>"
showAddButton="true"
page='<%= …Run Code Online (Sandbox Code Playgroud)