html link with image not displaying in firefox

Hello

A html image link will not display the image

This is happening in Firefox version 15.0

In internet explorer 9 the image displays with the link

Here is the code

<a href="javascript:<portlet:namespace/>complete();" > <img src="<%= renderResponse.encodeURL(renderRequest.getContextPath()+ "/images/dublin.gif") %>" alt="Confim Interest"/> </a>

Open in new window


This is in a jsp file that is part of a portlet.  The porlet container is liferay 5.2.1

Any help would be great thanks
naFiannaAsked:
Who is Participating?
 
fourckCommented:
the problem maybe is in URL form (so in renderRequest.getContextPath()).

why are you using absolute URLs? try instead to use relatives one, so you just need to set images URLs to be as following : images\dublin.gif
0
 
fourckCommented:
could you give us a live demo page ?
0
 
naFiannaAuthor Commented:
Do you mean a url to my PC?  

If so I cant do that, sorry, but i can attach the jsp file

I just rolled back to Firefox 14.01b12 and have the same problem
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
naFiannaAuthor Commented:
Sorry, i am having trouble attaching the file

<%@ page session="false" %>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="com.cr2.portlets.*"%>
<%@ page import="com.cr2.portlets.data.model.*"%>
<%@ taglib uri='/WEB-INF/tld/liferay-portlet.tld' prefix='portlet'%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix='c'%>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix='fmt'%>

<jsp:useBean id="fields" scope="request" class="java.lang.Object" />
<jsp:useBean id="genericLists" scope="request" class="java.util.HashMap" />
<jsp:useBean id="bitypename" scope="request" class="java.lang.String" />
<jsp:useBean id="dataTypeValues" scope="request" class="java.util.HashMap" />
<jsp:useBean id="requestData" scope="request" class="java.util.HashMap" />

<portlet:defineObjects />
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="Language" />

<%
Locale locale = new Locale((String)request.getAttribute("language"));
ResourceBundle bundle = ResourceBundle.getBundle("Language", locale);
%>

<portlet:actionURL var="update">
	<portlet:param name="action" value="update"/>
</portlet:actionURL>

<portlet:actionURL var="cancel">
    <portlet:param name="action" value="return"/>
</portlet:actionURL>

<portlet:actionURL var="saveDraft">
	<portlet:param name="action" value="saveDraft"/>
</portlet:actionURL>

<portlet:actionURL var="saveTemplate">
	<portlet:param name="action" value="saveTemplate"/>
</portlet:actionURL>

<portlet:actionURL var="deleteDraft">
	<portlet:param name="action" value="deleteDraft"/>
</portlet:actionURL>

<portlet:actionURL var="cancelToPrevList">
    <portlet:param name="action" value=""/>
</portlet:actionURL>

<% String strUuid = UUID.randomUUID().toString(); %>
<script type="text/javascript" src='<%= renderResponse.encodeURL(renderRequest.getContextPath()+ "/dwr/interface/cr2Ajax.js?strUuid="+strUuid) %>'> 
</script>

<script type="text/javascript"
        src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
							+ "/dwr/interface/Ajax.js") %>'>
</script>

<script type="text/javascript"
	src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
							+ "/dwr/interface/BWServiceUtil.js") %>'> 
</script>

<script type="text/javascript"
	src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
							+ "/dwr/engine.js") %>'> 
</script>

<script type="text/javascript"
	src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
							+ "/dwr/util.js") %>'> 
</script>

<script>
<%@ include file="cr2_json_util_.jsp" %>
function <portlet:namespace/>complete()
{
	jQuery("[id*=DisplayValue]").each(function(i){
		var selector="#"+this.id.substr(12)+" option:selected";
		selector=selector.replace(/\./g,"\\.");
		this.value=jQuery(selector).text();
	});
	var fileSelector="#<portlet:namespace/>ADVERTISING.CAMPAIGN :file".replace(/\./g,"\\.");
	if(0<jQuery(fileSelector).length){
		var formSelector="#<portlet:namespace/>ADVERTISING.CAMPAIGN".replace(/\./g,"\\.");
		jQuery(formSelector).attr("enctype","multipart/form-data");
		jQuery(formSelector).attr("encoding","multipart/form-data");
	}
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").submit();
}
function <portlet:namespace/>saveDraft()
{
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").action = "<%=saveDraft.toString()%>";		
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").submit();
}

function <portlet:namespace/>saveTemplate()
{
	document.getElementById("<portlet:namespace/>saveTemplate").style.display="block";
	jQuery("#<portlet:namespace/>saveTemplate").dialog('open');
}

function <portlet:namespace/>deleteDraft()
{
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").action = "<%=deleteDraft.toString()%>";		
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").submit();
}

function <portlet:namespace/>cancel()
{
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").action = "<%=cancel.toString()%>";		
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").submit();
}

function <portlet:namespace/>cancelToPrevList()
{
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").action = "<%=cancelToPrevList.toString()%>";		
	document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").submit();
}

function <portlet:namespace/>validateAmount(id, type)
{
    if(<portlet:namespace/>isOldFirefox())
    {
        return;
    }
    var component = document.getElementById(id);
    var value = component.value;
    var portletNamespace = '<portlet:namespace/>';
    //check for numeric characters
    if(!<portlet:namespace/>isNumber(value, type))
    {
        alert("Please enter a valid " + type);
        setTimeout("document." + portletNamespace + "form1." + component.id + ".focus()", 1);
        setTimeout("document." + portletNamespace + "form1." + component.id + ".select()", 1);
    }
}

function <portlet:namespace/>isOldFirefox()
{
    var userAgent = navigator.userAgent;
    var fireFoxPos = userAgent.indexOf("Firefox");
    if(fireFoxPos < 0)
    {
        //not Firefox so continue
        return false;
    }
    //userAgent is Firefox so see if its version 3.6 or greater
    var version = parseFloat(userAgent.substr(fireFoxPos + 8, 3));
    if(version < 3.6)
    {
        return true;
    }
    return false;
}


function <portlet:namespace/>isNumber(aNumber, type)
{
    var validCharacters = <portlet:namespace/>returnValidCharacters(type);
    var character;
    var countDecimalPt = 0;
    for(var i = 0; i < aNumber.length; i++)
    {
        character = aNumber.charAt(i);
        if(character == '.')
        {
            if(++countDecimalPt > 1)
            {
                return false;
            }
        }
        if(validCharacters.indexOf(character) < 0)
        {
            return false;
        }
    }
    return true;
}

function <portlet:namespace/>returnValidCharacters(type)
{
    var zeroToNine = "0123456789";
    var decimalPt = ".";
    if(type == "INTEGRAL")
    {
        return zeroToNine;
    }
    else if(type == "AMOUNT")
    {
        return zeroToNine + decimalPt;
    }
}
</script>

<c:if test="${bUseShamsiCalendar}">
<script type="text/javascript"
	src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
							+ "/javascript/jalaliCalendar.js") %>'> 
</script>
</c:if>

<script type="text/javascript"
	src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
							+ "/javascript/jquery.ui.i18n.all.js") %>'> 
</script>

<script type="text/javascript">   
    jQuery(function() {
	var calendarLanguage = '<%=request.getLocale().getLanguage()%>';
	if(<c:out value="${bUseShamsiCalendar}"/>)
		calendarLanguage+='-sh';
	jQuery.datepicker.setDefaults(jQuery.extend(jQuery.datepicker.regional['']));
	jQuery.datepicker.setDefaults(jQuery.extend(jQuery.datepicker.regional[calendarLanguage]));
       var dateArray = jQuery('form[name|="<portlet:namespace/>"] .BW_DATE');
       for(var i = 0; i < dateArray.length; i++)
       {
           jQuery("#" + dateArray[i].id).datepicker({dateFormat: 'dd/mm/yy'});   
       }
	});
</script>

<c:if test="${not empty error}">
	<span class="portlet-msg-error">
		<c:out value="${error}"/>
	</span>
</c:if>
<c:if test="${not empty success}">
	<span class="portlet-msg-success">
		<c:out value="${success}"/>
	</span>
</c:if>

<c:choose>
	<c:when test="${bw_timed_out}">
		<span class="portlet-msg-success">
			<fmt:message key="com.cr2.portlets.ADVERTISING.CAMPAIGN.sessionExpired"/>
		</span>
	</c:when>
    <c:otherwise>		
        <form id="<portlet:namespace/>ADVERTISING.CAMPAIGN"  name="<portlet:namespace/>form1" action="<%=update%>" method="post">
            <input type="hidden" name="draftid" value="<c:out value="${draftid}"/>"/>
			<input type="hidden" id="<portlet:namespace/>isClone" name="<portlet:namespace/>isClone" value="<c:out value="${isClone}"/>"/>
			<input type="hidden" id="<portlet:namespace/>bitemplatename" name="<portlet:namespace/>bitemplatename" />			
            <table class="CR2BasicTableLayout">
                <tbody class="portlet-section-body">		
                    <c:forEach var="tdr" items="${fields}" > <!-- tdr is two dimentional array row -->
                      <tr>
                        <c:forEach var="tdc" items="${tdr}" > <!-- tdc is two dimentional array column -->
                           <c:choose>
                               <c:when test="${tdc!=null}"> 
                                    <c:set var="title" value="${tdc}"/>                                    
                                    <c:choose>
                                        <c:when test="${bitypename=='BIDRAFT'}">                                                                                                                                                             
                                            <% String title="com.cr2.portlets." +request.getAttribute("bioriginaltype") +"."+ pageContext.getAttribute("title") + ".title";  %>
                                            <td><%= bundle.getString(title) %></td>
                                            <td>
                                                <input id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" type="text" value="<c:out value="${requestData[tdc]}"/>"/>
                                            </td> 
                                        </c:when>
                                        <c:otherwise>
                                            <% String title="com.cr2.portlets." +request.getAttribute("bitypename") +"."+ pageContext.getAttribute("title") + ".title";  %>
                                            <td><%= bundle.getString(title) %></td>
                                            <td>
                                                    <%
                                                         GenericDataListBean genericDataListBean = (GenericDataListBean)genericLists.get(pageContext.getAttribute("title"));    
                                                         if(genericDataListBean != null){
                                                    %>
                                                        <select id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />">
                                                            <%
                                                                for(int k = 0; k < genericDataListBean.getList().size(); k++){    
                                                                    GenericDataBean genericDataBean = (GenericDataBean)genericDataListBean.getList().get(k);
                                                            %>
                                                            <option value="<%=k %>"><%=genericDataBean.getBwdtvdescription() %></option>
                                                            <%
                                                                }//end for
                                                            %>
                                                        </select>
                                                        <input id="DisplayValueBW_<c:out value="${tdc}"/>" name="DisplayValueBW_<c:out value="${tdc}"/>" type="hidden" value=""/>
                                                    <%  }//end if   
                                                    else {
                                                        //if type not on the request look it up in the property file
                                                        Map attributeTypesMap = (Map)request.getAttribute("attributeTypesMap");
                                                        String type = (String)attributeTypesMap.get(pageContext.getAttribute("title"));
                                                        if(type == null || type.equals("")){
                                                            String typeKey = "com.cr2.portlets." + request.getAttribute("bitypename") + "." + pageContext.getAttribute("title") + ".type";
                                                            type = bundle.getString(typeKey);
                                                        }
                                                        if(type.equals("BOOLEAN")){%>
                                                            True<input id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" type="radio" value="1" checked />
                                                            False<input id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" type="radio" value="0"/>
                                                         <% }else if (type.equals("DATE")){%>
                                                            <input name="<portlet:namespace/>BW_<%=pageContext.getAttribute("title")%>" id="BW_<portlet:namespace/><%=pageContext.getAttribute("title")%>" value="" class="BW_DATE"/>
                                                         <%}else if(type.equals("AMOUNT") || type.equals("INTEGRAL")){%>
                                                            <input type="text" id="<portlet:namespace/>BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" onblur="<portlet:namespace/>validateAmount('<portlet:namespace/>BW_<c:out value="${tdc}"/>', '<%=type%>')" />
                                                         <%}else if(type.equals("FILE")){%>
                                                            <input id="file_BW_<c:out value="${tdc}" />" name="file_BW_<c:out value="${tdc}" />" type="file" onchange="document.getElementById('BW_<c:out value="${tdc}" />').value = this.value;"/>
                                                            <input id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" type="hidden" />
                                                        <%}else if(type.equals("ACCOUNT ID") || type.equals("CURRENCY") || type.equals("UTILITY ID")){ %>
                                                            <select id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />">
                                                                <%
                                                                    SimpleDataListBean listBean = (SimpleDataListBean)dataTypeValues.get(pageContext.getAttribute("title"));
                                                                    if(listBean != null && null!=listBean.getList()){
                                                                        for(int m = 0; m < listBean.getList().size(); m++){
                                                                            SimpleDataBean dataBean = (SimpleDataBean) listBean.getList().get(m);
                                                                %>
                                                                            <option value="<%=dataBean.getId()%>"><%=dataBean.getName()%></option>
                                                                <%
                                                                        }
                                                                    }
                                                                %>
                                                            </select>
                                                      <%  }//end if   
                                                    else if(((String)pageContext.getAttribute("tdc")).equalsIgnoreCase("sourceuserid")){%>
                                                        <input id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" type="text" value="<c:out value="${sourceuserid}"/>"/>
                                                    <%}else{ %>
                                                        <input id="BW_<c:out value="${tdc}" />" name="BW_<c:out value="${tdc}" />" type="text" value="<c:out value="${requestData[tdc]}"/>"/>
                                                    <% }
						}%> 
                                            </td> 
                                        </c:otherwise>
                                    </c:choose>                                    
                               </c:when>
                               <c:otherwise>
                                    <td colspan="2">&nbsp;</td> 
                               </c:otherwise>
                           </c:choose>
                        </c:forEach>
                      </tr>      
                    </c:forEach>
                    <tr>
                        <td  align="center" colspan="2">
							<a href="javascript:<portlet:namespace/>complete();" > <img src="C:\images\dublin.gif" alt="Confim Interest"/> </a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </c:otherwise>
</c:choose>

<div id="<portlet:namespace/>saveTemplate" title="Save Template" style="display:none">
	<table>
		<tr>
			<td><fmt:message key="com.cr2.portlets.templatetransaction.templateName"/></td>
			<td>&nbsp;</td>
			<td>
				<input type="text" name="<portlet:namespace/>bitemplatenameValue"  id="<portlet:namespace/>bitemplatenameValue" />
			</td>
		</tr>
		<tr><td colspan="2">&nbsp;</td></tr>
		<tr>
			<td>
				<input id="<portlet:namespace/>saveTemplateButton" type="button" value="Ok" onclick="<portlet:namespace/>onSaveTemplate();"/> 
			</td>
			<td>&nbsp;</td>
			<td>
				<input id="<portlet:namespace/>cancelTemplateButton" type="button" value="Cancel" onclick="<portlet:namespace/>onCancelTemplate();"/>
			</td>
		</tr>
	</table>
</div>

<script>
<%
	if (requestData!=null)	{
		Iterator it = requestData.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry biValues = (Map.Entry)it.next(); 
%>
			if (document.getElementById("<portlet:namespace/>BW_<%=biValues.getKey()%>")!=null)
			{
				document.getElementById("<portlet:namespace/>BW_<%=biValues.getKey()%>").value= "<%=biValues.getValue()%>";
			}
			else if (document.getElementById("BW_<%=biValues.getKey()%>")!=null)
			{
				document.getElementById("BW_<%=biValues.getKey()%>").value= "<%=biValues.getValue()%>";
			}		
<%			it.remove(); 
		} 
	}

%>
</script>	

<script>
jQuery(function() {

	jQuery( "#<portlet:namespace/>saveTemplate" ).dialog({
			bgiframe: true,
			autoOpen: false,
			height: 150,
			width: 400,
			modal: false,
			resizable:false
		});
	}
	);	
</script>
<script>
	function <portlet:namespace/>onCancelTemplate()
	{
		jQuery("#<portlet:namespace/>saveTemplate").dialog('close');
	}
	function <portlet:namespace/>onSaveTemplate()
	{
		document.getElementById("<portlet:namespace/>bitemplatename").value = document.getElementById("<portlet:namespace/>bitemplatenameValue").value;
		document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").action = "<%=saveTemplate.toString()%>";		
		document.getElementById("<portlet:namespace/>ADVERTISING.CAMPAIGN").submit();
	}
</script>

Open in new window

0
 
naFiannaAuthor Commented:
When i inspect the web page with firebug the image is visible in the link properties:

<a href="javascript:_ADVERTISINGCAMPAIGN_WAR_ADVERTISINGCAMPAIGN_INSTANCE_1Hlv_complete();">
<img alt="Confim Interest" src="C:\images\dublin.gif">

Open in new window

0
 
naFiannaAuthor Commented:
Hi, your were right about renderRequest.getContextPath()

It just wouldnt allow the image to display (strange thought because it is our standard code and other images on other portlets are displaying)

Anyway i played around with the URL and this is working for me (code below)

(We have IIS on the same machine as this is demo-land)

Thanks for the help

<a href="javascript:<portlet:namespace/>complete();" >
								<img src="http://localhost/BW4213/dublin.gif" alt="Confirm Interest"/>
							</a>

Open in new window

0
 
naFiannaAuthor Commented:
Thanks for the help.  I got too close to the issue, cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.