Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Cool Dude
javascript issues
August 14, 2009 4:00 PM
Answer

Cool Dude

Rank: New Member

Posts: 4

Join Date: August 11, 2009

Recent Posts

I am trying to build a portlet to display an existing web 2.0 application that uses ajax/javascript technology quite extensively. My code for the portlet (view.jsp) is something like this:

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<script type="text/javascript" language="JavaScript" src="http://localhost:8900/myapp/jsapi"></script>
<h1>Simple Viewer</h1>
<div id="myDivContainer" style="border-width: 1px; border-style: solid;"></div>
<script type="text/javascript" language="JavaScript">
.....
</script>


I notice the code in the "script" tag does not even get invoked. Is there something wrong the way I am invoking javascript?
I am using liferay-portal-5.2.3
Appreciate all your help.
Amos Fong
RE: javascript issues
August 14, 2009 4:31 PM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1898

Join Date: October 7, 2008

Recent Posts

Hey Mr. dude,

Are you missing the ".js" in your sourcefile?
Cool Dude
RE: javascript issues
August 14, 2009 5:12 PM
Answer

Cool Dude

Rank: New Member

Posts: 4

Join Date: August 11, 2009

Recent Posts

Appreciate your quick response.
No. The javascript library in the location "http://localhost:8900/myapp/jsapi" ends with a js extension.
Ziggy ©
RE: javascript issues
August 14, 2009 5:24 PM
Answer

Ziggy ©

Rank: Expert

Posts: 293

Join Date: June 8, 2008

Recent Posts

if it ends with a .js extension then you need to include the extension as well in teh url.
Cool Dude
RE: javascript issues
August 17, 2009 11:20 AM
Answer

Cool Dude

Rank: New Member

Posts: 4

Join Date: August 11, 2009

Recent Posts

On further research I found that it is actually a servlet url. But interestingly the same code runs fine as a non-portlet. When run as a liferay portlet I get the following result (using firebug):

<script type="text/javascript" src="/my-portlet/js/test.js?browserId=firefox&minifierType=js&t=1250286480715">
1Failed to load source for: http://localhost:8080/my-portlet/js/test.js?browserId=firefox&minifierType=js&t=1250286480715
</script>


Does liferay poses any restriction on the kinds of webapp that can be displayed as a portlet?
Thanks again for all your help.
Dileep Maurya
RE: javascript issues
December 25, 2013 4:02 AM
Answer

Dileep Maurya

Rank: New Member

Posts: 1

Join Date: August 8, 2013

Recent Posts

HI All,
I am also having same issue.
I want to know why extra parameters are getting appended in the below url. when loading js file from liferay-portlet.xml
http://localhost:8080/my-portlet/js/test.js?browserId=firefox&minifierType=js&languageId=en_US&b=6011&t=1386737075000