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
Change in behavior in Freemarker portlet 7.0E GA1 to 7.3.2 ga3
I have a Freemarker portlet that works fine when deployed to 7.3.0 ga1 but seems to be missing css, template and javascript references when deployed to 7.3.2 ga3. Nothing unusual in coding. The portlet code uses references like:
for css and
when referencing JavaScript I set my template path to "/". I do use an "include" statement to select between two different templates in the actual portket code like so (which works when deployed to 7.3.0)
But what I see in the dev studio console when debugging is:
2020-06-15 13:03:56.732 ERROR [http-nio-9080-exec-7][FreeMarkerPortlet:81] /templates/members.ftl is not a valid include
2020-06-15 13:03:57.023 WARN [http-nio-9080-exec-10][code_jsp:173] {code="404", msg="Not Found", uri=/o/org.mydomain.myportlet/css/main.css}
I also don't see any of my JavaScript in the source view in the browser console. It's almost as though the base reference to the Freemarker portlet isn't correct. I checked for breaking changes and I really didn't see anything that might cause this behavior. Is there anyone else out there using Freemarker as the view and experiencing something like this? Can't seem to find a correct incantation...
com.liferay.portlet.header-portlet-css=/css/main.css
for css and
com.liferay.portlet.footer-portlet-javascript=/js/classlist.js
when referencing JavaScript I set my template path to "/". I do use an "include" statement to select between two different templates in the actual portket code like so (which works when deployed to 7.3.0)
// The basic logic here is that when we have a single portlet with multiple pages
// We need to make a decision about which page to display hence the use of "render"
@Override
public void render(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
HttpServletRequest h2request = PortalUtil.getHttpServletRequest(request);
HttpServletRequest orequest = PortalUtil.getOriginalServletRequest(h2request);
String param = StringUtils.checkNull(orequest.getParameter("processmode"));
if(param.length()>0 && param.equals("classlist"))
include("/templates/classinfo.ftl", request, response);
else
include("/templates/members.ftl", request, response);
}
But what I see in the dev studio console when debugging is:
2020-06-15 13:03:56.732 ERROR [http-nio-9080-exec-7][FreeMarkerPortlet:81] /templates/members.ftl is not a valid include
2020-06-15 13:03:57.023 WARN [http-nio-9080-exec-10][code_jsp:173] {code="404", msg="Not Found", uri=/o/org.mydomain.myportlet/css/main.css}
I also don't see any of my JavaScript in the source view in the browser console. It's almost as though the base reference to the Freemarker portlet isn't correct. I checked for breaking changes and I really didn't see anything that might cause this behavior. Is there anyone else out there using Freemarker as the view and experiencing something like this? Can't seem to find a correct incantation...
I am going to reply to myself here. I am not exactly sure how this was sorted out. It may have been a result for running a clean and then deploy but I have to admit it was very strange while I was trying to sort it out.
In any case except for the clean and it also looks like I moved the templates folder out of META-INF/resources and back to src/main/resources. Maybe that fixed it. Maybe it was something else
In any case except for the clean and it also looks like I moved the templates folder out of META-INF/resources and back to src/main/resources. Maybe that fixed it. Maybe it was something else
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™