Sometimes we have to know which liferay version we are using, so how can we know? We can know the liferay version in different ways. 1. Liferay has provided some utility methods to know the which liferay version we are using , Here is the utility method ReleaseInfo.getReleaseInfo() It prints this statement " Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014) " as i am using community version it shoes as CE. 2. Also we can also identify by response headers as below screenshot. If your using the chrome, right click on the browser and click inscept element , and navigate to the network . you will see the URLS , click on the any url. 3. Also we can see during server startup as below statement Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014)
Whenever we create finder method by default it generates many methods associating with it starts by method name as findBy ..... Sometimes it may requires you to display the results in the ASC/DESC. So we have one method which accepts OrderByComparator as parameter. Below example explains you how to retrieve the Title in the Ascending order. OrderByComparator comparator = OrderByComparatorFactoryUtil.create(TestModelImpl.TABLE_NAME, "title", orderByType.equals("asc")) jsonTestEntryPersistance.findByTitle("name",comparator);
We often see after submitting the form and refresh the page you will see the same result will be adding in the DB. So how to get rid of this? Here we have 2 options to eliminate this behaviour. 1. By Declaring the tag in the liferay-portlet.xml after <icon> tag <action-url-redirect> true </action-url-redirect> 2.After doing our logic we can redirect to specified URL by using actionResponse. actionResponse.sendRedirect(PortalUtil.getLayoutURL(themeDisplay.getLayout(),themeDisplay)); Here we are redirecting to the friendly url of that page. The above will be redirect to the below URL as //group/test/test1----- (group/<your-community-name>/pageName) .
Comments
Post a Comment