• 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

Is it to hide my javascript in the project directory?

 
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear experts,

I'm wondering is it possible to hide my javascripts that do the validation of forms under the directory of my project folder, just like the way CSS can be hidden away in the directory? However, I'm not sure how it can be done. Hope someone can share with me how. Many thanks.

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you're asking.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems to be a web app question, so I've moved it to the Servlets forum.

What do you mean by "hide". You can't "hide" CSS, or it wouldn't work. So you'll need to explain what you mean by that.
 
tangara goh
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:I'm not sure what you're asking.



What I meant is that I would like to tuck away the Javascripts at the directory, just like css.

With css, I can just put a reference link to the stylesheet and I hope to do the same for my javscript .

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, well "hiding" is certainly not the right word for that.

So you are asking if you can move the JavaScript out of the page and into a separate file? If so, then yes. Create a file containing the script, give it a file type of .js, and use the src attribute on the script tag to reference it.

Example:

[Moved to the HTML forum.]
 
tangara goh
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

So you are asking if you can move the JavaScript out of the page and into a separate file? If so, then yes. Create a file containing the script, give it a file type of .js, and use the src attribute on the script tag to reference it.

Example:

[Moved to the HTML forum.]



OK. But, the thing is I can't find a folder for this js in Netbean IDE. After right-clicking my project name, should I file it under others+ ?

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't matter where you put it as long as it within the web app, but not under WEB-INF. Forming the URL to the file should be done using full server-relative addressing which is discussed in the JSP FAQ.
 
Are we home yet? Wait, did we forget the tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic