[jboss-user] [JBoss Portal] - JBoss 4.05GA + JPortal 2.4 & javascript problem

gsferra@imnet.it do-not-reply at jboss.com
Wed Mar 28 12:01:37 EDT 2007


Hi,
I wish to include a javascript file into a JSP portlet so I added the following on top of my JSP page:


  | <%@taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
  | 
  | <portlet:defineObjects/>
  | <script type="text/javascript" src="/js/mylib.js"></script>
  | ...
  | 

When my portlet loads I got an "undefined object" javascript error while trying to invoke an object belonging to the included file (the same occurs if I try to use everything else - objects or functions - defined in that file).
Every other script directly written in my JSP works well, such as:


  | <script type="text/javascript">
  | alert("Hey, this works");
  | </script>
  | 

Thinking about a path problem I also tryed that:


  | <%@taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
  | 
  | <portlet:defineObjects/>
  | <script type="text/javascript" src='<%= response.encodeURL(request.getContextPath() + "/js/mylib.js") %>'></script>
  | ...
  | 

achieving the same, identical and frustrating results.
Please, help me, I really need to solve this matter.

Thank you,
-- 
Gaetano Sferra

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032416#4032416

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032416



More information about the jboss-user mailing list