Skip to main content

Dynamic Query with PortletClassLoader using PortletBeanLocatorUtil


Hello,

Recently I faced some issue with dynamic query. Even though my service layer and Portlet are in the same war  I got class not found exception for the model class. Liferay could not able to load Model class while using the dynamic query So I used the Portlet Class loader like below.


             


Then my issue got resolved.

Comments

Popular posts from this blog

Checking in Liferay permissions for a User in JSON WS or in a normal Java Class

Hello, In this post we will see how to check if a user has a specific permission assigned to him. If you want to do it in a JSP you can use the below code. In JSP permissionChecker,layout and portletroot id objects are implicitly available. boolean showOwnerType = PortletPermissionUtil.contains(permissionChecker, layout, portletDisplay.getRootPortletId(), “your permission name”); Suppose if you want to do it in a class which does not have these implicit objects or it does not have access to HttpServletRequest or PortletRequest then you can use the below code. PermissionChecker permissionChecker =PermissionThreadLocal. getPermissionChecker (); boolean status = PortletPermissionUtil. contains ( permissionChecker , “your portlet root id”, “your permission” ); You can find the portlet root id from Liferay page. Goto the page where the portlet resides and click on Settings icon- > Look and Feel -> and goto Advanced Styling tab. There you can see the p...

Disabling and Enabling Minfying of JS and CSS resources in Liferay

   Disabling minification of JS and CSS The minifiation and comibing all the JS and CSS resources is done at two levels or at two places. 1. First are the JS and CSS files which you have included in the portlet JSPs i.e by header portlet css or header portlet js flies or the script tags which you have included in the JSP files 2. Second JS and CSS files are the ones which Liferay uses like, jquery, lodash, alloy ui and all these resources also gets minfied and bundled into one JS or CSS file and loaded in a single HTTP call. Now there are two scenarios one is if you want to debug the Javascript code you have included in the Portlet View JSP, and the other one is when you load a page and you wan to see all the individual JS and CSS files getting loaded instead of a single mindifed bundle. Disabling minification of JS and CSS in portlet view JSPs When you include any JS files or CSS files inside the portlet jsps, by default they get minified when the JSP is rende...