Foros de discusión

(RESOLVED) renderRequest is not found.

Sam Wan, modificado hace 13 años.

(RESOLVED) renderRequest is not found.

Liferay Master Mensajes: 660 Fecha de incorporación: 3/03/09 Mensajes recientes
With liferay 5.2.3, tomcat 6.0 and liferay plugins sdk, after deployed the portlet onto liferay portal, adding the portlet onto the webpage causes the following exceptions:


An error occurred at line: 70 in the jsp file: /jsp/init.jsp
PortletPreferences cannot be resolved to a type
67: //Format dateFormatDate = FastDateFormatFactoryUtil.getDate(locale, timeZone);
68: //Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(locale, timeZone);
69: 
70: PortletPreferences preferences = renderRequest.getPreferences();
71: 
72: String portletResource = ParamUtil.getString(request, "portletResource");
73: 




Since portal-impl.jar can't be used in plugins development, should I copy some of the classes from portal-impl.jar into my current working directory and recompile it? or I have to use Hook on to it? I think Hook is a way to go, however your mileage may vary.

Very appreciate for any suggestion and help.
Thanks
Sam
Mazhar Anwar, modificado hace 13 años.

RE: renderRequest is not found.

Regular Member Mensajes: 125 Fecha de incorporación: 5/02/10 Mensajes recientes
Hi Sam,

Have you imported PortletPreferences class in your jsp?

add the following line in init.jsp.

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

Hope it will solve your problem.
Sam Wan, modificado hace 13 años.

RE: renderRequest is not found.

Liferay Master Mensajes: 660 Fecha de incorporación: 3/03/09 Mensajes recientes
Mazhar Anwar:
Hi Sam,

Have you imported PortletPreferences class in your jsp?

add the following line in init.jsp.

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

Hope it will solve your problem.
Mazhar Anwar:
Hi Sam,

Have you imported PortletPreferences class in your jsp?

add the following line in init.jsp.

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

Hope it will solve your problem.
Mazhar Anwar:
Hi Sam,

Have you imported PortletPreferences class in your jsp?

add the following line in init.jsp.

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

Hope it will solve your problem.


Hi Mazhar,

How have you been? Hope you are well.
Thanks a great help. You solved my trouble again. emoticon

What about the following errors:


An error occurred at line: 101 in the jsp file: /jsp/init.jsp
WebKeys.THEME_DISPLAY cannot be resolved to a type
98: //if (Validator.isNotNull(portletResource)) {
99: //  preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
100: //}
101: ThemeDisplay themeDisplay =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
102: %&gt;
103: 
104: <liferay-theme:defineobjects />


An error occurred at line: 107 in the jsp file: /jsp/wizProductList.jsp
currentURL cannot be resolved
104:                            "/ext/manage_subscription/page");
105:            rowURL.setParameter("prorductId",
106:                            String.valueOf(prod.getProductId()));
107:            rowURL.setParameter("redirect", currentURL);
108: 
109:            // Name
110: 



Very appreciate for your help.

Thanks
Sam
Mazhar Anwar, modificado hace 13 años.

RE: renderRequest is not found.

Regular Member Mensajes: 125 Fecha de incorporación: 5/02/10 Mensajes recientes
Hi Sam,

I am doing good, Thanks emoticon

For your issues,

You can use either liferay tag for theme or instantiate themeDisplay Object manually.

That is use
<liferay-theme:defineObjects />

OR

ThemeDisplay themeDisplay =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

Use of Liferay Tag will be better as it will initialize all the objects and then you can directly use themeDisplay object anywhere in your jsp.

You can remove "ThemeDisplay themeDisplay =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);" from your code.

And if you want to use the above line you need to import following class in your init.jsp.
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>



For the second error, it seems you have not set currentURL String and using it.
You can replace the currentURL with "themeDisplay.getURLCurrent()".


HTH emoticon
Sam Wan, modificado hace 13 años.

RE: renderRequest is not found.

Liferay Master Mensajes: 660 Fecha de incorporación: 3/03/09 Mensajes recientes
Mazhar Anwar:
Hi Sam,

Have you imported PortletPreferences class in your jsp?

add the following line in init.jsp.

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

Hope it will solve your problem.


Hi Mazhar,

With this problem, I got a new error after included PortletPreferences and RenderRequest class in the ini.jsp file:


12:40:05,176 INFO  [PortletHotDeployListener:346] 1 portlet for product-list-portlet is available for use
12:40:13,406 ERROR [PortletRequestDispatcherImpl:316] org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 247 in the generated java file
Duplicate local variable renderRequest

Stacktrace:
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 247 in the generated java file
Duplicate local variable renderRequest



Here is the the first few lines of the ini.jsp file:


&lt;%
//Format dateFormatDate = FastDateFormatFactoryUtil.getDate(locale, timeZone);
//Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(locale, timeZone);

RenderRequest renderRequest = (RenderRequest)request.getAttribute("javax.portlet.request");
//RenderResponse renderResponse = (RenderResponse)request.getAttribute("javax.portlet.response");
//PortletConfig portletConfig = (PortletConfig)request.getAttribute("javax.portlet.config");

//PortletPreferences preferences = renderRequest.getPreferences();

//String portletResource = ParamUtil.getString(request, "portletResource");

//if (Validator.isNotNull(portletResource)) {
//	preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
//}
ThemeDisplay themeDisplay =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
%&gt;


Any idea?

Thank you very much.
Sam.
Sam Wan, modificado hace 13 años.

RE: renderRequest is not found.

Liferay Master Mensajes: 660 Fecha de incorporación: 3/03/09 Mensajes recientes
I've got all these resolved.
thanks for the great help everyone.

Sam
bhavishya goyal, modificado hace 13 años.

RE: renderRequest is not found.

Junior Member Mensajes: 58 Fecha de incorporación: 26/02/11 Mensajes recientes
hi sam
i m also getting same problem
in view jsp
&lt;%
/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%&gt;

&lt;%@ include file="init.jsp" %&gt;
<portlet:defineobjects /> 

<aui:form method="post" name="fm">
	<liferay-util:include page="/html/portlet/calendar/tabs1.jsp" />
	
	<c:choose>
		<c:when test="<%= tabs1.equals(&quot;summary&quot;) %>">
			&lt;%@ include file="/html/calenderportlet/summary.jspf" %&gt;
		</c:when>
		<c:when test="<%= tabs1.equals(&quot;day&quot;) %>">
			&lt;%@ include file="/ab-portlet/docroot/html/
 calendarportlet/day.jspf" %&gt;
		</c:when>
		<c:when test="<%= tabs1.equals(&quot;week&quot;) %>">
			&lt;%@ include file="/html/portlet/calendar/week.jspf" %&gt;
		</c:when>
		<c:when test="<%= tabs1.equals(&quot;month&quot;) %>">
			&lt;%@ include file="/html/portlet/calendar/month.jspf" %&gt;
		</c:when>
		<c:when test="<%= tabs1.equals(&quot;year&quot;) %>">
			&lt;%@ include file="/html/portlet/calendar/year.jspf" %&gt;
		</c:when>
		<c:when test="<%= tabs1.equals(&quot;events&quot;) %>">
			&lt;%@ include file="/html/portlet/calendar/events.jspf" %&gt;
		</c:when>
		<c:when test="<%= tabs1.equals(&quot;export-import&quot;) %>">
			&lt;%@ include file="/html/portlet/calendar/export_import.jspf" %&gt;
		</c:when>
	</c:choose>
</aui:form>

&lt;%
if (!tabs1.equals("summary")) {
	PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(pageContext, tabs1), currentURL);
}
%&gt;

error is
Multiple annotations found at this line:
	- Duplicate local variable 
	 contact
	- Duplicate local variable 
	 layout
	- Duplicate local variable plid
	- Duplicate local variable 
	 timeZone
	- Duplicate local variable 
	 layouts
	- Duplicate local variable 
	 locale
	- Duplicate local variable 
	 realUser

please help me to solve this problem
Ahmed Ibrahim, modificado hace 11 años.

RE: renderRequest is not found.

New Member Mensajes: 3 Fecha de incorporación: 13/01/13 Mensajes recientes
Hi Everybody,
the solution to renderRequest cannot be resolved is to put the <portlet:definedObjects/> before any object declaration that use hidden request.
thanks and regards