Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sam E
(RESOLVED) renderRequest is not found.
July 7, 2010 5:52 AM
Answer

Sam E

Rank: Liferay Master

Posts: 660

Join Date: March 2, 2009

Recent Posts

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:

 1
 2An error occurred at line: 70 in the jsp file: /jsp/init.jsp
 3PortletPreferences cannot be resolved to a type
 467: //Format dateFormatDate = FastDateFormatFactoryUtil.getDate(locale, timeZone);
 568: //Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(locale, timeZone);
 669:
 770: PortletPreferences preferences = renderRequest.getPreferences();
 871:
 972: String portletResource = ParamUtil.getString(request, "portletResource");
1073:



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
RE: renderRequest is not found.
July 7, 2010 3:08 AM
Answer

Mazhar Anwar

Rank: Regular Member

Posts: 125

Join Date: February 5, 2010

Recent Posts

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 E
RE: renderRequest is not found.
July 7, 2010 5:04 AM
Answer

Sam E

Rank: Liferay Master

Posts: 660

Join Date: March 2, 2009

Recent Posts

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:

 1
 2An error occurred at line: 101 in the jsp file: /jsp/init.jsp
 3WebKeys.THEME_DISPLAY cannot be resolved to a type
 498: //if (Validator.isNotNull(portletResource)) {
 599: //  preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
 6100: //}
 7101: ThemeDisplay themeDisplay =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
 8102: %>
 9103:
10104: <liferay-theme:defineObjects />
11
12
13An error occurred at line: 107 in the jsp file: /jsp/wizProductList.jsp
14currentURL cannot be resolved
15104:                            "/ext/manage_subscription/page");
16105:            rowURL.setParameter("prorductId",
17106:                            String.valueOf(prod.getProductId()));
18107:            rowURL.setParameter("redirect", currentURL);
19108:
20109:            // Name
21110:


Very appreciate for your help.

Thanks
Sam
Mazhar Anwar
RE: renderRequest is not found.
July 7, 2010 5:23 AM
Answer

Mazhar Anwar

Rank: Regular Member

Posts: 125

Join Date: February 5, 2010

Recent Posts

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 E
RE: renderRequest is not found.
July 7, 2010 5:44 AM
Answer

Sam E

Rank: Liferay Master

Posts: 660

Join Date: March 2, 2009

Recent Posts

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:

 1
 212:40:05,176 INFO  [PortletHotDeployListener:346] 1 portlet for product-list-portlet is available for use
 312:40:13,406 ERROR [PortletRequestDispatcherImpl:316] org.apache.jasper.JasperException: Unable to compile class for JSP:
 4
 5An error occurred at line: 247 in the generated java file
 6Duplicate local variable renderRequest
 7
 8Stacktrace:
 9org.apache.jasper.JasperException: Unable to compile class for JSP:
10
11An error occurred at line: 247 in the generated java file
12Duplicate local variable renderRequest


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

 1
 2<%
 3//Format dateFormatDate = FastDateFormatFactoryUtil.getDate(locale, timeZone);
 4//Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(locale, timeZone);
 5
 6RenderRequest renderRequest = (RenderRequest)request.getAttribute("javax.portlet.request");
 7//RenderResponse renderResponse = (RenderResponse)request.getAttribute("javax.portlet.response");
 8//PortletConfig portletConfig = (PortletConfig)request.getAttribute("javax.portlet.config");
 9
10//PortletPreferences preferences = renderRequest.getPreferences();
11
12//String portletResource = ParamUtil.getString(request, "portletResource");
13
14//if (Validator.isNotNull(portletResource)) {
15//    preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
16//}
17ThemeDisplay themeDisplay =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
18%>


Any idea?

Thank you very much.
Sam.
Sam E
RE: renderRequest is not found.
July 7, 2010 5:51 AM
Answer

Sam E

Rank: Liferay Master

Posts: 660

Join Date: March 2, 2009

Recent Posts

I've got all these resolved.
thanks for the great help everyone.

Sam
bhavishya goyal
RE: renderRequest is not found.
March 12, 2011 11:50 PM
Answer

bhavishya goyal

Rank: Junior Member

Posts: 58

Join Date: February 26, 2011

Recent Posts

hi sam
i m also getting same problem
in view jsp
 1<%
 2/**
 3 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 4 *
 5 * This library is free software; you can redistribute it and/or modify it under
 6 * the terms of the GNU Lesser General Public License as published by the Free
 7 * Software Foundation; either version 2.1 of the License, or (at your option)
 8 * any later version.
 9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 */
15%>
16
17<%@ include file="init.jsp" %>
18<portlet:defineObjects />
19
20<aui:form method="post" name="fm">
21    <liferay-util:include page="/html/portlet/calendar/tabs1.jsp" />
22   
23    <c:choose>
24        <c:when test='<%= tabs1.equals("summary") %>'>
25            <%@ include file="/html/calenderportlet/summary.jspf" %>
26        </c:when>
27        <c:when test='<%= tabs1.equals("day") %>'>
28            <%@ include file="/ab-portlet/docroot/html/
29 calendarportlet/day.jspf" %>
30        </c:when>
31        <c:when test='<%= tabs1.equals("week") %>'>
32            <%@ include file="/html/portlet/calendar/week.jspf" %>
33        </c:when>
34        <c:when test='<%= tabs1.equals("month") %>'>
35            <%@ include file="/html/portlet/calendar/month.jspf" %>
36        </c:when>
37        <c:when test='<%= tabs1.equals("year") %>'>
38            <%@ include file="/html/portlet/calendar/year.jspf" %>
39        </c:when>
40        <c:when test='<%= tabs1.equals("events") %>'>
41            <%@ include file="/html/portlet/calendar/events.jspf" %>
42        </c:when>
43        <c:when test='<%= tabs1.equals("export-import") %>'>
44            <%@ include file="/html/portlet/calendar/export_import.jspf" %>
45        </c:when>
46    </c:choose>
47</aui:form>
48
49<%
50if (!tabs1.equals("summary")) {
51    PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(pageContext, tabs1), currentURL);
52}
53%>

error is
 1Multiple annotations found at this line:
 2    - Duplicate local variable
 3     contact
 4    - Duplicate local variable
 5     layout
 6    - Duplicate local variable plid
 7    - Duplicate local variable
 8     timeZone
 9    - Duplicate local variable
10     layouts
11    - Duplicate local variable
12     locale
13    - Duplicate local variable
14     realUser

please help me to solve this problem
Ahmed Ibrahim
RE: renderRequest is not found.
January 13, 2013 4:12 AM
Answer

Ahmed Ibrahim

Rank: New Member

Posts: 3

Join Date: January 13, 2013

Recent Posts

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