How to  include external javascript and css resources to a jsf?

I need to include external css and javascript files to my jsf page. Using the code below does not work because all the styles on the css page are ignored and the functions within the js files are not executed.
<link rel="stylesheet" type="text/css" href="/resources/styles/style.css" />
<script language="JavaScript" src="/resources/javascript/util.js"></script>When I try to execute any js function within a script tag on a jsf page I get an object expected error.
I googled about my problem and found this piece of code for importing styles for an external css.
<style type="text/css">
@import url("/resources/styles/style.css");
</style>How could I add an external javascript file to my jsf?

Used the relative urls in my first post as well as these, and both were not working.
<link rel="stylesheet" type="text/css" href="./resources/styles/style.css" />
<script language="JavaScript" src="./resources/javascript/util.js"></script>The ./ tells that the external file can be found by starting at the current directory and working down the path to the specified file. This is my directory structure. Index.jsf is the file that references the external js and css files.
-Webcontent
|_index.jsf
|_resources
|__styles
| |__style.css
|__javascript
|__util.js
Either way I still can't reference the files that I need. Calling a javascript function results in an object expected error, and the styles are ignored.
If I include the js file directly in the jsf then I can get it to work. I don't want to do this because I have created a handful of seperate js files, and do not want to include all of them in one page. I am using myfaces and tomahawk if that helps.

Similar Messages

  • Including external javascript and css files in servlet

    Hello,
    I am struggling to generate an HTML page from within a servlet using external javascript and css files. I am not sure how to point the servlet to the external files.
    Any code sample to accomplish the above will be much appreciated.
    Thanks inadvance,
    Antana.

    Can't you just include the following in your servlet?
           response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Getting CSS</title>");
            out.println("<link rel='stylesheet' type='text/css' href='yourCSS.css' />");
            out.println("<script language='JavaScript' SRC='yourScript.js'></script>");
            out.println("</head>");
           //...

  • 4.2 "Include Standard JavaScript and CSS" option removed ?

    Hi,
    APEX 4.2, Oracle 11g r2.
    I was using the option *"Include Standard JavaScript and CSS"* from the page attributes. It was set to *"No"* in all pages as I manage my own JQuery versions.
    We upgraded to 4.2 yesterday, and I see the option is still here on 4.2.
    I simply tried to set it to "Yes" for a test, but now the option has disappeared !! I can't set it back to "No"...
    In each page, if I set it to "Yes" and apply changes, the option is not here when I go back to the page attributes.
    Bug ?
    Or maybe this option has been removed from 4.2 ?

    Hi,
    yes this has intentionally been removed for applications / pages which do not use the feature. As you mentioned yourself and what we have seen from other customers is that someone doesn't just want to exclude that on a single page and instead want to control it for the application. Which made it a little bit cumbersome, because a developer had to set it for each new page.
    That's why we have created a page template placeholder for *#APEX_JAVASCRIPT#* and *#APEX_CSS#* to give you full control where to load the APEX libraries and if you don't want to load them, just remove them from the page template as Vikram already pointed out.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to optimize portal javascript and css - where is scriptset property ?

    Hi,
    I've downloaded <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d164c5ee-0901-0010-4fbf-d0856b5c8a84">How to Finetune Performance of Portal Platform</a> document,
    which contains portal performance optimization tips.
    In this pdf file there is a section about optimizing javascript and css code by using
    scriptset  property and there is also appropriate reference to the help.sap.com portal page.
    The problem is that this page is not there so I'm unable to configure this scriptset property.
    Any ideas where can it be found?
    Regards,
    Ladislav

    yes - go into System Adminstration --> System Configuration and then Service Configuration (in the detailed Nav).
    In there, find application com.sap.portal.epcf.loader - In Services --> epcfloader the property you seek is script.set and you should change from standard to optimize.  Then you need to restart the service.
    Hope that helps
    Haydn

  • How to include external JavaScript files

    Hello All,
    i'm wondering haow can i include externel JavaScrip files, there is an clip-example with a function in the same JSP file
    but not how to include a file?
    <body>
    <script language='JavaScript' src="menu/menu.js'></script>
    If some one has a clip i would appreciate.
    Thanks
    Gino

    <script src="resources/myscript.js"></script>
    I did this exact thing in my jsp but it did not work, nothing popped up.
    When I tried replacing it with:
    <script language="JavaScript" type="text/javascript"><![CDATA[
    function postMessage(message) {
    alert(message);
    ]]></script>
    It worked. Can someone tell me why? Can't i refer to javascript files this way?

  • How to include external javascript file in an html

    hello
    i've an html file placed in apache/webapps/test folder this html file includes an external javascript file placed at same level
    i'm includind the file as
    <script src="file1.js"></script>but the file does not gets included
    but when the sam folder "test" is paste outside apache the html file including the external file runs properly.
    Thank You

    flounder wrote:
    cotton.m wrote:
    What's really pathetic is that this is your third cross post on this same stupid off topic topic.
    You are really a dumb f&#117;ck you know that?If they knew that they were a dumb f&#117;ck then they wouldn't be a dumb f&#117;ck!That's a logical and reasonable conclusion. Therefore I very much doubt that the OP is capable of it.
    Hmmm this is interesting. It now shows the entity escapes rather than their values when you quote.

  • Include custom javascript and css in uix page

    Hello
    I got a UIX page based on the pageLayout template and i wanted to include some custom things (css, js) inside the resulting html header like this:
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title="mypage"/>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=loc"/>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=sys"/>
    <script source="customScript.js"><contents><!-- --></contents></script>
    </metaContainer>
    <contents>
    <body>
    Unfortunatly only ONE thing from within "metaContainer" gets included in the final html file. Is there a way to include everything from within "metacontainer"?
    Thanks for your help,
    Philipp Stecher

    I think metacontainer is a named child, and like all named children it can only have one node.
    Does this work?
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title="mypage">
    <contents>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=loc"/>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=sys"/>
    <script source="customScript.js"><contents><!-- --></contents></script>
    </contents>
    </head>
    </metaContainer>

  • How to include external Javascript script files?

    We have had a number of students run into problems with our LMS.  The support staff at the LMS say that it is due to the version of Java (JRE) that the student is running on their device.  The LMS says that they only support Java JRE version 1.6 and 1.7.
    I have found some Javascript on the Oracle site that checks the client JRE version, but it requires that the student brings in one of their Javascript script libraries:
    <script src="https://www.java.com/js/deployJava.js"></script>
    <script>
        if (deployJava.versionCheck('1.6+')) {
            alert('OK to Continue');
        } else {
            alert('This course will only work Java version 1.6 and up');
    </script>
    I am familiar with the Javascript windows in various Captivate items.  I am using Captivate version 7.
    My question is how can i include the current deployJava.js script lib from https://www.java.com/js/  (and possibly some other script libs) with all courses that I publish from now on?  Is there some template file that I can update so that this script lib is automatically included in all courses that I publish using SCORM 2004 ver. 4?
    Thanks

    <script src="resources/myscript.js"></script>
    I did this exact thing in my jsp but it did not work, nothing popped up.
    When I tried replacing it with:
    <script language="JavaScript" type="text/javascript"><![CDATA[
    function postMessage(message) {
    alert(message);
    ]]></script>
    It worked. Can someone tell me why? Can't i refer to javascript files this way?

  • How to include external files in JSP

    hi,
    How to include external files like image or javascript in to jsp pages.
    I am using MVC frame work. So i have to use request dispatcher. While calling the pages trough dispatcher the external files are missing from the output. Also am using tomcat as server,web.xml(deployment descriptor ) is also configured.
    regards
    sree

    When you use the request dispatcher, the relative path for all your ressources becomes the relative path of your calling serlvet and not the JSP/servlet that you call. Make sure to use the full relative path such as:
    /PATH_TO_YOUR_DIRECTORY/myRessource.ext
    NOT
    SOME_DIRECTORY/myRessource.ext
    Jeff

  • How to include external style sheet

    Hi !!
    Can any one explain how to include external style sheet.

    Anil,
    Simply include the css file as I demonstrated in my last post and then reference one the css classes by name in the "styleClass" attribute of the component. So, if the css file that have included in my JSP file (as demonstrated in the prev post) contains a class like:
    .spicyPink {
    color:#FF1CAE;
    font-weight:bold;
    Then I would simply reference this class in the component as folows:
    <af:outputText value="Pretty In Pink" styleClass="spicyPink"/>
    However, you can also add styling to a component inline and accomplish the same task:
    <af:outputText value="Pretty In Pink" inlineStyle="color:#FF1CAE;
    font-weight:bold;"/>
    The thing to remember is that other than the use of styleClass and inlineStyle, referencing and including css in your JSP/JSPX pages is really no different that used in an HTML page.
    Here is reference to help you along:
    http://www.w3.org/TR/REC-CSS1#containment-in-html
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Embedded Javascript and CSS removed from mail

    Hey folks,
    I wrote a small app to send a html email to myself.
    When I sent it inline all the embedded javascript and css were removed.
    When sent as a .html page attachment and opened from within the browser (Gmail, Mozilla 2.0)
    all the embedded script and css were gone. However when downloaded to the machine, it was all there.
    Looks like this is a browser issue, would anyone know how to get around it?
    It's so that I can have collapsable headers in my email message.
    Thanks,
    Mark.

    Hi Tony.
    Yes, it's possible. Read [Wiki WPC FAQ|https://wiki.sdn.sap.com/wiki/display/KMC/WebPageComposer-FrequentlyAskedQuestions+%28FAQ%29#WebPageComposer-FrequentlyAskedQuestions%28FAQ%29-WhataboutusingstandardHTMLpagesinWPC%3F].
    KM supports relative links in HTML documents so it may be necessary include any dependent files in the same folder as the HTML document.
    In case of a web page and its dependent files are stored in different folders you need editing the source html code:
    1. use Portal Drive and any text editor (I prefer Notepad++. It has the feature "Search and Replace in files") to open the html source file.
    2. search for links to dependent files and add the following pattern: /irj/go/km/docs//<path to an dependent file>/ before a filename, for example:
    You have a web page with css file. The page is stored in documents repository under the folder with ID old_pages. The css is resides in css folder.
    So the existing code
    <LINK REL=STYLESHEET TYPE="text/css" HREF="css/style.css">
    should be replaced with the
    <LINK REL=STYLESHEET TYPE="text/css" HREF="/irj/go/km/docs//documents/old_pages/css/style.css">
    Best regards,
    Aliaksandr

  • Where to put own JavaScript and CSS-Stylesheets in GlassFish ?

    Hi out there,
    we have some applications which are using external JavaScript libraries, CSS-Stylesheets and Images.
    On OHS we had a directory for those files which we aliases in dads.conf.
    Where do we have to put this directory when switching to GlassFish and Apex Listener ?
    Regards and thanks
    Markus

    Hi Markus,
    if you use the "regular" GlassFish, this shouldn't be a big issue. Just create a subdirectory in the GlassFish's docroot-directory for each alias you have now and copy the corresponding content into that directory. See "Copy Oracle Application Express Images" in the Listener documentation - the handling for other static content is similar to the handling for images.
    If you plan to test this with the Embedded Web Container (embedded GlassFish), this will not work that way, because you only have the fixed contexts for images, apex and the listener-internal functions.
    -Udo

  • Load the External text and css file for more frames

    hello..
           I created one Movie file. In that I load the External text and css file in first frame and display the first variable value in one text box.
    And then in 2nd frame I use another one text field and display the 2nd variable value like that I want to load the more variable in more textboxes with different frames.
         I loaded  for first variable value in first frame. But I don't know how to do next frames like that..
         Help me...

    You need to load them in the frames they are in.  You can store the loaded data in variables in frame 1, but you will need to extend that layer so that whatever is stored is avaliable in other frames.  The code to load the data into the other textfields can then be done in the frames where it is needed.
    There are other options, such as not using other frames for content or having all of them in frame 1 and making them invisible until you get to the other frames where they get turned visible.

  • How to disable 'Enable JavaScript' and 'Display PDF in browser' in Adobe Reader 9.1 msi?

    I'd like to how to disable 'Enable JavaScript' and 'Display PDF in browser' in Adobe Reader 9.1 msi.
    Any help would be appreciated.

    NeoChang:
    You can modify the installation package using the Adobe Customization Wizard to toggle the "Display PDF in Browser" but I have not found a setting to disable JavaScript from the Wizard. I have created a script which makes the changes, but it has to be run for every user since that info is stored in the User hive of the Windows registry.
    Disable JavaScript:
    REG ADD "HKCU\SOFTWARE\Adobe\Acrobat Reader\9.0\JSPrefs" /v bEnableJS /d 0 /t REG_DWORD /f
    Disable Browser Integration:
    REG ADD "HKCU\Software\Adobe\Acrobat Reader\9.0\Originals" /v bBrowserIntegration /d 0 /t REG_DWORD /f
    Michael
    ~Simplicity of Character is a Natural Result of Profound Thought~

  • How to include the promotion and sales deal in the value contract ?

    Question : Can a value contract contain other special pricing agreement ?
    If yes, how to include the promotion and sales deal in the value contract ?
    Thanks for your input.
    Oscar

    Hi Oscar,
    I have not worked on this aspect as such but once you create a value contract I think you as well create a promotion and sales deal for the customer with whom you have value contract with in the validity period of the contract and system should pick up data accordingly as the customer is same (Contract) and is within the validity period.
    Pl give feed back.
    regards
    Srini

Maybe you are looking for

  • Prevent update to document after status is changed

    Hi all, I configured a new status profile for a sales document ITEM and want to stop user from editing the item once the status is changed to 'Close'. I have tried with Business Transaction 'Edit' (forbidden is set) and 'No Change Allowed' (allowed i

  • Why is the formatting in my Contact list screwed up?

    Why is the formatting in my Contacts list screwed up?  The State in the address list is missing and "Netherlands" is added to all of my US addresses. This occurs after I sync in iTunes, but the Contact is listed normally in Outlook.

  • VPA drops connection

    Hi Mac friends, I'm having trouble getting my VPA connection to stay connected on my iPhone 4. I pay for this service and it works great on my desktop/laptop. I entered my correct PPTP settings and it connects and holds the connection just fine. Then

  • Problems setting up 2way SSL with option Client certs requested Not Enfor

    Hi, Iam having problems trying to set up 2 way SSL with the option "Clients Certs Requested But Not Enforced". I am using DefaultIdentityAsserter with my own implementation of UserNameMapper. And I have the login-config set to CLIENT-CERT in web.xml.

  • How to run VI in new thread

    How can I run my labVIEW VI in a new thread without having to restart LabVIEW every time before I run?