2

I use Bootfaces version 1.1.3 and I try to provide a custom version of jquery as described here:

CSS files, JS files and CDNs

These are my first lines of my template:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:b="http://bootsfaces.net/ui" xmlns:p="http://primefaces.org/ui">

<h:head>

<title>Internet Domains</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />

<h:outputScript name="/reg/js/jquery-1.11.1.min.js" position="first" />

And this is what was finally generated:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><link type="text/css" rel="stylesheet" href="/reg/resources/theme.css?ln=primefaces-aristo" /><link rel="stylesheet" type="text/css" href="/reg/resources/css/other/core.css?ln=bsf" /><link rel="stylesheet" type="text/css" href="/reg/resources/css/bsf.css?ln=bsf" /><!--[if lt IE 9]><script src="/reg/resources/js/html5shiv.js?ln=bsf"></script><script src="/reg/resources/js/respond.js?ln=bsf"></script><![endif]--><script type="text/javascript" src="/reg/resources/jq/jquery.js?ln=bsf"></script><script type="text/javascript" src="/reg/resources/jsf.js?ln=javax.faces&amp;stage=Development"></script><script type="text/javascript" src="/reg/resources/js/alert.js?ln=bsf"></script><script type="text/javascript" src="/reg/resources/js/bsf.js?ln=bsf"></script><script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.projectStage='Development';}</script><meta name="viewport" content="width=device-width, initial-scale=1"/>

<title>Internet Domains</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />

<script type="text/javascript" src="/reg/js/jquery-1.11.1.min.js"></script>

I expected that the <script type="text/javascript" src="/reg/resources/jq/jquery.js?ln=bsf"></script> will be replaced by <script type="text/javascript" src="/reg/js/jquery-1.11.1.min.js"></script>. This is how I understood the documentation. But it does not happen. I can avoid including the query.js?ln=bsf useing the web.xml parameter net.bootsfaces.get_jquery_from_cdn. But I need to load jquery before Bootfaces load alert.js and bsf.js. Can anyone help me to get this working?

Micer
  • 8,731
  • 3
  • 79
  • 73
Dominic
  • 129
  • 1
  • 10

1 Answers1

1

The algorithm recognizing the custom jquery library only checks if the filename begins with "jquery". In your case, BootsFaces 1.1.3 is confused by the folder name. I've corrected this after seeing your bug report, but the bugfix will only be available in BootsFaces 1.2.0, which today (Dec 17, 2017) hasn't been released yet (but should be released soon).

So either you try the developer preview BootsFaces 1.2.0-SNAPSHOT or you can move the jquery.js file to the root folder. Alternatively, you can add the attribute lib to specify the subfolder of the jquery.js file. Note that the latter option also means you have to put the file into the ressources folder.

Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37
  • Hey, that's great, thank you for your very fast reaction! I tried the lates snapshot release of december 16th ( downloaded here [link](https://oss.sonatype.org/content/repositories/snapshots/net/bootsfaces/bootsfaces/1.2.0-SNAPSHOT/) ). I think the fix is not included there and there is not yet a newer one. I am going to try it then and givea feedback. – Dominic Dec 18 '17 at 20:45
  • Oops. No idea what went wrong - but I guess it's best you debug the problem yourself. It should be a five-minutes effort. The class `AddResourcesListener` contains a method called `addJavaScript`. The first few lines of the method decide whether jQuery is loaded or not. In my sourcecode the crucial line is line #388. Please have a look what's happening there. I'm sure you'll spot the bug quickly, so I can fix it with the next version of BootsFaces. Thanks in advance! – Stephan Rauh Dec 20 '17 at 20:57