4 Replies Latest reply on Dec 23, 2008 8:58 AM by anbazhagan prasanna

    including javascript, CSS in portlets

    anbazhagan prasanna Newbie

      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 !!!