0
String mailBody = "<div style='margin-left:10px;'>"
                       +"<div style='font-weight: bold; font-size: 19px; padding-top: 8px;'>Anindya</div>"
                       +"<div style='font-size: 17px;'>Senior Salesforce with Oracle Developer</div>"
                       +"<div style='margin-top:5px;padding-bottom: 4px; font-size: 12px;'><img src="+resourceRequest.getContextPath()+"/images/icon/Mobile-phone.png\" height='16' width='16'></img>9830093200</div>"
                       +"<div style='padding-bottom: 4px; font-size: 12px;'><img src='../images/icon/location-icon.png' height='16' width='16'></img>Kolkata</div>"
                       +"<div style='display:inline-block;padding-bottom: 4px; font-size: 12px;'><img src='../images/icon/email-icon.png' height='16' width='16' style='float:left;margin-right:2px;'></img><div style='float:left;'>anindyamallik@gmail.com</div></div>"
                       +"</div>";

I want to show this string in a pop up, but while showing to pop up the    

enter image description hereimages are not available. How to resolve that?

Can anyone help me please??

lucifer
  • 2,297
  • 18
  • 58
  • 100

1 Answers1

0

If you want to get dynamic context path on JSP page of your portlet, you can use request.getContextPath() of HttpServletRequest object as following:

JSP:

String mobileIcon = request.getContextPath()  + "/images/icon/Mobile-phone.png";
String locationIcon = request.getContextPath()  + "/images/icon/location-icon.png";
String emailIcon = request.getContextPath() + "/images/icon/email-icon.png";

While if you want to get it in action file, e.g. in serveResource method, you can get context name from PortletContext object as following:

Action:

PortletContext portletContext = resourceRequest.getPortletSession().getPortletContext();
String mobileIcon = "/" + portletContext.getPortletContextName()  + "/images/icon/Mobile-phone.png";
String locationIcon = "/" + portletContext.getPortletContextName()  + "/images/icon/location-icon.png";
String emailIcon = "/" + portletContext.getPortletContextName()  + "/images/icon/email-icon.png";
Parkash Kumar
  • 4,710
  • 3
  • 23
  • 39