0

I'm using JSF 2.0. I have

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script language="text/javascript" >

in my source, but when I deploy it, I'm getting:

<SCRIPT type=text/javascript 
src="appmonitorgreeting_xhtml_files/jquery-latest.min.js"></SCRIPT>

This suggessts that you can just add the URL the normal way, but for some reason JSF is stripping out my url and just using the file name. Here's the full head in case it helps:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
  <h:head>
    <meta charset="utf-8" content=""/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7"/>
    <h:outputStylesheet library="css" name="appmonitor.css"/>
 <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script language="text/javascript" >
    function show(area) {
        var obj = document.getElementById(area)
        obj.style.display = (obj.style.display == 'inline') ? 'none' : 'inline'
};
jQuery(document).ready(function() {
  alert("see it does work");
});
</script>
  </h:head>

How do I make it use http://code.jquery.com/jquery-latest.min.js as the src?

6
  • see stackoverflow.com/questions/8067904/jsf-2-resources-with-cdn or stackoverflow.com/questions/13667052/… Commented Nov 26, 2013 at 0:58
  • Thanks for the quick reply. Do you know if you can use <ui:insert name="resources" /> and <ui:define name="resources"> without using ui:composition? I tried both ways and couldn't get it to work. Commented Nov 26, 2013 at 2:06
  • Please ignore Arun. He has no utter idea what problem you're currently facing and by following his ignorant advice you would only confuse yourself more. Commented Nov 26, 2013 at 10:55
  • The modified URL in the generated <script src> isn't the default behavior (the uppercased <SCRIPT> element for sure also not as that's invalid XHTML). So you must have somewhere a custom resource handler or some weird servlet filter or such. Please list the libraries used in your application and the resource handlers listed in faces-config.xml and the servlet filters listed in web.xml. Commented Nov 26, 2013 at 10:56
  • Correction, I'm using JSF 2.1. Libraries: Java EE, TopLink, Oracle XML Parser V2, CDI. faces-config.xml is empty (except for the boiler plate stuff). Here's most of what's in my web.xml: Commented Nov 26, 2013 at 17:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.