Foros de discusión

javascript issues

Cool Dude, modificado hace 14 años.

javascript issues

New Member Mensajes: 4 Fecha de incorporación: 11/08/09 Mensajes recientes
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.
thumbnail
Amos Fong, modificado hace 14 años.

RE: javascript issues

Liferay Legend Mensajes: 2047 Fecha de incorporación: 7/10/08 Mensajes recientes
Hey Mr. dude,

Are you missing the ".js" in your sourcefile?
Cool Dude, modificado hace 14 años.

RE: javascript issues

New Member Mensajes: 4 Fecha de incorporación: 11/08/09 Mensajes recientes
Appreciate your quick response.
No. The javascript library in the location "http://localhost:8900/myapp/jsapi" ends with a js extension.
thumbnail
Ziggy ., modificado hace 14 años.

RE: javascript issues

Expert Mensajes: 293 Fecha de incorporación: 8/06/08 Mensajes recientes
if it ends with a .js extension then you need to include the extension as well in teh url.
Cool Dude, modificado hace 14 años.

RE: javascript issues

New Member Mensajes: 4 Fecha de incorporación: 11/08/09 Mensajes recientes
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, modificado hace 10 años.

RE: javascript issues

New Member Mensaje: 1 Fecha de incorporación: 8/08/13 Mensajes recientes
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