• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to JSF, having trouble with JS in JSF

 
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I decided to learn by making a project, already did some basic stuff, but the thing that I'm having issues with is JS.

As far as I know for not outputscript and outputstylesheet are pretty similar.  




My folder structure

WebContent
|-- META-INF
|-- WEB-INF
|-- resources
     |-- css
 
Philip Freeman
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Posted by mistake without finishing, continuing here:

My folder structure

WebContent
|-- META-INF
|-- WEB-INF
|-- resources
     |-- css
 
Philip Freeman
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, dunno wtf is going on here, stuff is getting posted each time I'm in middle of typing. Going to come back later after I type this somewhere else. Sorry for spam and this shit I made. If some mod is reading you can delete I wont mind.
 
Philip Freeman
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for bad language, having a bad day.
 
Philip Freeman
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Failing to add JS to the page, CSS works.

Folder structure:

WebContent
|-- META-INF
|-- WEB-INF
|-- resources
|    |-- css
|    |    |-- bootstrap.min.css
|    |    |-- ie10-viewport-bug-workaround.css
  |-- navbar-fixed-top.css
|    |-- js
          |-- bootstrap.min.js
  |-- ie10-viewport-bug-workaround.js
index.xhtml


After reading this https://stackoverflow.com/questions/8367421/how-to-reference-css-js-image-resource-in-facelets-template?answertab=votes#tab-top I still do not view my mistake, but I tried all of the
stuff mentioned there, just in case. And why not, I can learn something. But JS still not working. Sorry for noob question and my previous mistakes while posting, I just not noticed that tabing and hiting space is a bad idea.

 
Saloon Keeper
Posts: 27858
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the View Page Source option on the displayed webpage. Either the JavaScript should be part of the page view OR there should be a URL link to the JavaScript. If it's a link, try typing that link into your browser's navigation bar to make sure that it's resolving.

If it's a link, also make sure that nothing tries to run the Javascript before the page has finished loading, since otherwise stuff may not reliably be there when you need it.

If you're using Firefox, check the Firebug console for Javascript errors and the net trace for "404" or 500-series errors.
 
Philip Freeman
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Cechekd links, they seem fine to me, example of a small one



No errors, and as far as I see nothing is trying to run the Javascript before the page has finished loading.
 
Philip Freeman
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm blind, i forgot

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

Sorry, trully stupid of me, no idea how I missed that and failed to notice it for 4 hours.
 
Yeah, but does being a ninja come with a dental plan? And what about this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic