图像不会出现在Jquery POP Up中

时间:2015-09-09 12:16:58

标签: jquery liferay

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 here张图片不可用。如何解决?

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

如果要在portlet的JSP页面上获取动态上下文路径,可以使用request.getContextPath() HttpServletRequest对象,如下所示:

<强> 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";

如果你想在行动档案中获取它,例如在serveResource方法中,您可以从PortletContext对象获取上下文名称,如下所示:

<强>动作:

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";