留言板

[Solved] Search-container shows blank page on Next

Clément Derodit,修改在12 年前。

[Solved] Search-container shows blank page on Next

New Member 帖子: 2 加入日期: 11-9-30 最近的帖子
Hi everyone,

For my project, I have to display a list of users. This list has two columns, one for the user's name and one for his id number.
This list can be very long so I need to paginate it.

I'm using a <liferay-ui:search-container> to achieve that. I display my portlet in a pop-up window.

After loading, I can see the created table with my data. But everytime I click on next or select a page number directly, the page goes blank and no error message is displayed.


Here is the code of my jsp :


&lt;%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%&gt;
&lt;%@taglib uri="http://liferay.com/tld/aui" prefix="aui"%&gt;
&lt;%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;

&lt;%@page import="java.util.ArrayList"%&gt;
&lt;%@page import="java.util.List"%&gt;
&lt;%@page import="javax.portlet.RenderResponse"%&gt;
&lt;%@page import="javax.portlet.PortletURL"%&gt;
&lt;%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%&gt;
&lt;%@page import="com.liferay.portal.kernel.util.ListUtil" %&gt;
&lt;%@page import="fr.msa.agora.z80tech.beans.RessourceDossierBean"%&gt;
<portlet:defineobjects />

<portlet:actionurl var="ressource" windowstate="<%= LiferayWindowState.NORMAL.toString() %>"></portlet:actionurl>

&lt;%
		List<ressourcedossierbean> lListeRessources = (ArrayList<ressourcedossierbean>) portletSession.getAttribute("listeRessources");
%&gt;
	<liferay-ui:search-container delta="10" emptyresultsmessage="No Results Were found for the Selected Criteria">
		<liferay-ui:search-container-results total="<%= lListeRessources.size() %>" results="<%= ListUtil.subList(lListeRessources,searchContainer.getStart(),searchContainer.getEnd()) %>" />
		<liferay-ui:search-container-row modelvar="ressourceDossierBean" classname="fr.msa.agora.z80tech.beans.RessourceDossierBean">

			<liferay-ui:search-container-column-text name="Dossier" property="idRessource" orderable="<%=true%>" orderableProperty="idRessource" />
			<liferay-ui:search-container-column-text name="Raison Sociale" property="raisonSociale" orderable="<%=true%>" orderableProperty="raisonSociale" />

		</liferay-ui:search-container-row>
		<liferay-ui:search-iterator paginate="true" />
	</liferay-ui:search-container>
</ressourcedossierbean></ressourcedossierbean>


In my view.jsp, I call my jsp with this code :


&lt;%
final String lCible = (String)renderRequest.getAttribute("z80portlet_page");
%&gt;

<portlet:renderurl var="pageCourante" windowstate="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
    <portlet:param name="jspPage" value="<%=lCible%>" />
</portlet:renderurl>

<aui:script> function showPopup() { AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) { var dialog = new A.Dialog({ title: '&lt;%=lTitle %&gt;', height: 480, width: 640, centered: true, draggable: false, resizable: false, close: false, modal: true }).plug(A.Plugin.IO, {uri: '&lt;%=pageCourante%&gt;'}).render(); dialog.show(); }); } showPopup(); </aui:script>


It seems the problem resides in the windowState of my jsp after clicking on next (it sould be LiferayWindowState.NORMAL but change into LiferayWindowState.EXCLUSIVE everytime emoticon ) When I change it to NORMAL in the url, it works (but it seems the paging doesn't work either emoticon )

I'm using Liferay 6.0.6 CE with an Apache Tomcat Server 6.0.29

Thanks for your help.


Solution : (add this in the jsp)

<%@page import="javax.portlet.PortletURL"%>

<%
PortletURL lPortletURL = renderResponse.createRenderURL();
lPortletURL.setWindowState(LiferayWindowState.NORMAL);
%>

<liferay-ui:search-container delta="10" emptyResultsMessage="No Results Were found" iteratorURL="<%= lPortletURL %>">