1 Reply Latest reply on Nov 22, 2013 9:15 AM by kenfinni

    How can I deliver javascript and html via embedded URL's?

    joshuapk

      I am trying to send some javascript and html to the browser.  In order to do so, I have code that embeds the following headers in the page:

      <script charset="utf-8" src="/lucidityodf-portlet/js/webodf.js" type="text/javascript"/>


      The problem is that jboss does not serve resources from the root URL; so this url:

      http://localhost:8080/lucidityodf-portlet/js/webodf.js

      ...results in a resource not found error.


      The javascript file resides in /js/webodf.js in the WAR file I used to deploy.  Where do I need to put this javascript so that it is visible to the "outside world"?

        • 1. Re: How can I deliver javascript and html via embedded URL's?
          kenfinni

          The easiest way to ensure that a javascript resource is given a url that is accessible within your JSF portlet is to use the outputScript tag from JSF:

           

          <h:outputScript library="js" name="webodf.js" />

           

          The javascript file would also need to be moved into the following location in the WAR:

          /resources/js/webodf.js

           

          Hope that helps.

          Ken