[jboss-user] [JBoss Portal] - including javascript, CSS in portlets

aspdeepak do-not-reply at jboss.com
Mon Dec 15 07:33:17 EST 2008

I am new to Portlets.
I have tried to include my javascript into jsp (Portlet-VIEW) .
The javascripts are written seperately under /js folder in my portlet's root directory.  

I am unable to access them directly in jsp. 
Not only the .js but also the .css

This was my first way of accessing the .js .

 <script src="../js/modal.js" type="text/javascript"></script>
  | <link rel="stylesheet" href="../css/calendar.css" type="text/css" />

I googled and found a solution.
Then I tried of using the jboss-portlet.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE portlet-app PUBLIC
  | "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
  | "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
  | <portlet-app>
  |     <!-- HelloWorldPortlet -->
  |     <portlet-app>
  |       <portlet>
  |           <portlet-name>calendarEventPortletTest</portlet-name>
  |               <header-content>
  |                   <link rel="stylesheet" type="text/css" href="/css/calendar.css" />
  |       <script language="JavaScript" type="text/javascript" src="/js/calendar.js"/>                                   
  |               </header-content>
  |       </portlet>
  | </portlet-app>

but the problem still persists.

To mention that I am using both the portlet.xml and jboss-portlet.xml
do i have to remove any of them? if so which one? if not what is the solution?

Any help is greatly appreciable !!! 

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

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

More information about the jboss-user mailing list