Posts

Showing posts with the label Liferay

Issue with Eclipse and IntelliJ when multiple jdk versions are installed.

When we are using IntelliJ and Eclipse simultaneously and if we want to use multiple/separate JDK versions then we should set environment variable as needed and then IDE should be restarted. In IntelliJ if we want to use Java 11 and in eclipse Java 8 then just add Runtime Environment to IDE setting and even if Jdk 8 is installed it will work as needed. Conclusion: Jdk 8 installed Jdk 11 is unzipped "System Environment variable" JAVA_HOME is set to Jdk 11 Eclipse and IntelliJ Runtime Env setting set to 8 and 11 respectively.  It should work.

Retriving username and password from session in Liferay 6.2

              String userName = null;                try { userName = PortalUtil.getUser(httpRequest).getEmailAddress(); } catch (Exception e) { System.out.println("Exception in retriving user name -> " + e.getMessage()); } String password = null; try { password = (String)httpRequest.getSession().getAttribute(WebKeys.USER_PASSWORD); } catch (Exception e) { System.out.println("Exception in retriving password -> " + e.getMessage()); } Note: Here for getting plain password we need to set below property in portal-ext.properties file. session.store.password=true

How to get liferay portlet or theme or hook war file name?

War file name would be generated using following steps: firstPart _ WAR _ secondPart First Part - can be found in liferay-display.xml file within your portlet or theme or hook from <portlet id=" firstPart "></portlet> Second Part - you can get from Liferay home -> tomcat -> ROOT -> < Your Project Folder Name >. Just remove hyphen (-) and underscores from name.

How to disable default success message in portlet?

Just have to add below lines in portlet.xml file inside <portlet>....</portlet> tag. <init-param> <name>add-process-action-success-action</name> <value>false</value> </init-param>

Liferay interview questions...

Liferay Questions:- Role of structure and template ? Can we create the template without structure? What is LDAP configuration in liferay ? What is LDAP configuration in liferay ? Where do you config the database settings ? Explain class scheduler in Liferay ? mail functionality ? service builder ? which classes  are generated after build the services ? local serviceIMPL class in liferay wt is purpose of  that ? what is assest publisher ? what is difference b/w liferay generic portlet and MVC portlet ? what is lifeay schdular ? what is liferay instance ? from action to render how to pass the parameter ? which method do we use from action to rendor? what is serveResource method() ? If u have 3 differen public pages  like welcome1,welcome2,weclome3 by default login portlet is there with out adding login portlet to every page each and every page of my community login page should be there. Java Basic Questions:- main concepts of oops what is...

Redirecting application to specific URL after logout in Liferay.

You just need to append an URL after logout URL as below... your_logout_url?referer=url_to_redirect

How to extend Liferay 6.2 session timeout by AJAX call?

There are lot of solutions present on Liferay forum, stackoverflow and many more can be found on google but all are very difficult, not clear and also not working.... So I found a simple solution which is working and I am sharing it with you people, and hope you will find it helpful!!! You just have to add below line to each AJAX call success at client side (in JavaScipt / JQuery / AngularJS). Liferay.Session.extend();

How to send mail from Liferay Portlet?

Image
import java.io.IOException; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletException; import com.liferay.mail.service.MailServiceUtil; import com.liferay.portal.kernel.mail.MailMessage; import com.liferay.util.bridges.mvc.MVCPortlet; /** * Portlet implementation class FeedbackPortlet */ public class FeedbackPortlet extends MVCPortlet { public void sendEmail(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { MailMessage mailMessage = new MailMessage(); mailMessage.setHTMLFormat(true); mailMessage.setBody("Your mail body"); mailMessage.setFrom(new InternetAddress("from_mail_id@something.com","Display Name in Inbox")); mailMessage.setSubject("Messag...