Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Urgent: even the most basic example of renderURL is not working.
Example from Liferay's tutorials:
File "init.jsp":
File "view.jsp":
File "add_entry.jsp":
All these files are in the same folder, yet I can't get this working. If I click the button, nothing happens. I tried everything: reinstalling the server, using a different portlet superclass, using module portlets (this one is a plugin portlet), etc. Just NOTHING works. It's completely broken and I've got no clue on what's going on.
No errors on eclipse console, though I'm getting this single error in the client (chrome) when clicking the button:
I really need to get this fixed. I also can't get any actionURL working: if I put a decorator stating that a method is enabled to perform an action, Liferay just doesn't find it. I could do both things just a few days ago, WHY can't I do them now? This is stressing me out a lot, I just don't understand how a widely used tool like Liferay can bug itself this hard.
Anybody knows why this happens?
Thank you...
File "init.jsp":
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<portlet:defineobjects />
<liferay-theme:defineobjects />
File "view.jsp":
<%@include file="init.jsp" %>
<portlet:renderurl var="addEntryURL">
<portlet:param name="mvcPath" value="/add_entry.jsp"></portlet:param>
</portlet:renderurl>
<aui:button-row>
<aui:button onclick="<%= addEntryURL.toString() %>" value="Add Entry"></aui:button>
</aui:button-row>
File "add_entry.jsp":
<%@ include file="init.jsp" %>
Test portlet
All these files are in the same folder, yet I can't get this working. If I click the button, nothing happens. I tried everything: reinstalling the server, using a different portlet superclass, using module portlets (this one is a plugin portlet), etc. Just NOTHING works. It's completely broken and I've got no clue on what's going on.
No errors on eclipse console, though I'm getting this single error in the client (chrome) when clicking the button:
VM266 guest:2 Uncaught SyntaxError: Unexpected token }
I really need to get this fixed. I also can't get any actionURL working: if I put a decorator stating that a method is enabled to perform an action, Liferay just doesn't find it. I could do both things just a few days ago, WHY can't I do them now? This is stressing me out a lot, I just don't understand how a widely used tool like Liferay can bug itself this hard.
Anybody knows why this happens?
Thank you...
Hi Kiko,
Can you also show us your Portlet class? Maybe attach your project to this message so I can try it out on my local?
Can you also show us your Portlet class? Maybe attach your project to this message so I can try it out on my local?
Sure, this is my portlet class. It's tottally untouched:
Thank you!
package com.test;
import java.io.IOException;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
/**
* Portlet implementation class PortletPrueba
*/
public class PortletPrueba extends GenericPortlet {
public void init() {
viewTemplate = getInitParameter("view-template");
}
public void doView(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
include(viewTemplate, renderRequest, renderResponse);
}
protected void include(
String path, RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException, PortletException {
PortletRequestDispatcher portletRequestDispatcher =
getPortletContext().getRequestDispatcher(path);
if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}
protected String viewTemplate;
private static Log _log = LogFactoryUtil.getLog(PortletPrueba.class);
}
Thank you!
I am assuming from your portlet that this is a 6.2 project? If possible, can you wrap up the project and attach it here so that I can try it locally? That might be the shortest path to a solution here.
Hey Andrew,
I have the same problem as the first post here, stated 7 years ago.
I followed the steps on the tutorial and as it says I should be able on that point to see this form when I click the addEntry button, but nothing happens.
Here are my classes:
view.jsp
edit_entry.jsp
init.jsp
Can you please help me?
Thank you in advance,
Savvas
I have the same problem as the first post here, stated 7 years ago.
I followed the steps on the tutorial and as it says I should be able on that point to see this form when I click the addEntry button, but nothing happens.
Here are my classes:
view.jsp
<%@ include file="/init.jsp" %>
<!-- System-generated URLs -->
<portlet:renderurl var="addEntryURL">
<portlet:param name="mvcPath" value="/edit_entry.jsp"></portlet:param>
</portlet:renderurl>
<aui:button-row>
<aui:button onclick="<%=addEntryURL.toString()%>" value="Add Entry"></aui:button>
</aui:button-row>
edit_entry.jsp
<%@ include file="/init.jsp" %>
<portlet:renderurl var="viewURL">
<portlet:param name="mvcPath" value="/view.jsp"></portlet:param>
</portlet:renderurl>
<portlet:actionurl name="addEntry" var="addEntryURL"></portlet:actionurl>
<aui:form action="<%=addEntryURL%>" name="<portlet:namespace />fm">
<aui:fieldset>
<aui:input name="name"></aui:input>
<aui:input name="message"></aui:input>
</aui:fieldset>
<aui:button-row>
<aui:button type="submit"></aui:button>
<aui:button type="cancel" onclick="<%= viewURL.toString() %>"></aui:button>
</aui:button-row>
</aui:form>
init.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet"%>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%>
<liferay-theme:defineobjects />
<portlet:defineobjects />
Can you please help me?
Thank you in advance,
Savvas
Hi Savvas,
First thing that I would suggest is adjusting your var values on your portlet urls. It might not make any difference, but for semantics I would still consider it. The convention I use is to to post fix the var with the url type... so addEntryRenderURL for the render url and addEntryActionURL for the other one.
Outside of that, not sure. Can you share your java class that is backing this portlet as well?
First thing that I would suggest is adjusting your var values on your portlet urls. It might not make any difference, but for semantics I would still consider it. The convention I use is to to post fix the var with the url type... so addEntryRenderURL for the render url and addEntryActionURL for the other one.
Outside of that, not sure. Can you share your java class that is backing this portlet as well?
Hey Andrew,
thank you for your response.
I am not sure if I understand what you mean by adjusting the values on my portlet urls. :/
So something like this:
view.jsp
edit_entry.jsp
You can find the whole project here
Some more information on the problem:
OS: Linux Mint 18.2 Sonya
Eclipse: Eclipse Java EE IDE for Web Developers. Version: Luna Service Release 2 (4.4.2)
Liferay: Liferay IDE 3.1.2.201709011126-ga3, Liferay GA4 (I also tried GA5)
I know for sure, that on other machines with the same OS/programs/versions it worked just fine. I do not understand why it won't work on my laptop.
Thank you in advance.
thank you for your response.
First thing that I would suggest is adjusting your var values on your portlet urls.
I am not sure if I understand what you mean by adjusting the values on my portlet urls. :/
... so addEntryRenderURL for the render url and addEntryActionURL for the other one
So something like this:
view.jsp
<%@include file="/init.jsp"%>
<!-- System-generated URLs -->
<portlet:renderurl var="addEntryRenderURL">
<portlet:param name="mvcPath" value="/edit_entry.jsp" />
</portlet:renderurl>
<aui:button-row>
<aui:button onclick="<%=addEntryRenderURL.toString()%>" value="Add Entry"></aui:button>
</aui:button-row>
edit_entry.jsp
<%@ include file="/init.jsp" %>
<portlet:renderurl var="viewRenderURL">
<portlet:param name="mvcPath" value="/view.jsp"></portlet:param>
</portlet:renderurl>
<portlet:actionurl name="addEntry" var="addEntryActionURL"></portlet:actionurl>
<aui:form action="<%=addEntryURL%>" name="<portlet:namespace />fm">
<aui:fieldset>
<aui:input name="name"></aui:input>
<aui:input name="message"></aui:input>
</aui:fieldset>
<aui:button-row>
<aui:button type="submit"></aui:button>
<aui:button type="cancel" onclick="<%= viewURL.toString() %>"></aui:button>
</aui:button-row>
</aui:form>
Can you share your java class that is backing this portlet as well?
You can find the whole project here
Some more information on the problem:
OS: Linux Mint 18.2 Sonya
Eclipse: Eclipse Java EE IDE for Web Developers. Version: Luna Service Release 2 (4.4.2)
Liferay: Liferay IDE 3.1.2.201709011126-ga3, Liferay GA4 (I also tried GA5)
I know for sure, that on other machines with the same OS/programs/versions it worked just fine. I do not understand why it won't work on my laptop.
Thank you in advance.
Hey Savvas,
Sorry -- I haven't had a chance to look at this yet, but I have just downloaded your project and will have a look this morning.
Sorry -- I haven't had a chance to look at this yet, but I have just downloaded your project and will have a look this morning.
Hey Andrew,
thank you so much! That will be amazing
thank you so much! That will be amazing

RE: Urgent: even the most basic example of renderURL is not working.
I've never had any problems with render, action or resource URLs and I have, literally, builtn100s in 7.1.
What is your system config? Are you able to share your project for me to try?
What is your system config? Are you able to share your project for me to try?
Thanks Andrew, I figured it out.
Glad to hear it! What was the issue (in case someone else comes along and sees this thread and has the same issue...)
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™