Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

New to JSF, having trouble with JS in JSF  RSS feed

 
Ranch Hand
Posts: 31
2
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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.

 
Bartender
Posts: 20099
101
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!