Posts

Showing posts from June, 2015

How to get context path in JQuery?

Suppose you want to get your context path in JS/JQuery on clicking an Button like, In JSP/HTML:- <input type="button" id="myButton"> In JQuery :- $('# myButton ').click(function() { console.log( myC ontextPath ); }); Then you can pass values to JS/JQuery as, <input type="button" id="myButton" myContextPath="${pageContext.request.contextPath}"> Then in JS/JQuery you can write as, $('# myButton ').click(function() {         var  myC ontextPath  = $(this).attr(' myC ontextPath '); console.log( myC ontextPath ); });

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

How to clear cache programmatically in JSP?

By adding below lines in JSP page we can achive this: <%              response.setHeader("Cache-Control","no-cache"); //HTTP 1.1              response.setHeader("Pragma","no-cache"); //HTTP 1.0              response.setDateHeader ("Expires", 0); //prevents caching at the proxy server   %> Other solution is by adding below lines in <head></head> of your JSP page: <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">

How to remove do-search.com from Mozilla Firefox?

Step 1. Open Firefox Step 2. In Address Bar type  about:config then hit enter. Step 3. Then Click I'll be careful, I promise!  button. Step 4. Then at top in Search text box type  do-search and you will get all entries for this infection. Step 5. Right click on them one by one and select RESET option. Step 6. Then Restart Firefox.