• 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

Include external js file in javascript not working.

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the Image, I want some text by external javascript file(that text , I want use in different jsp file), so I write code like this, but did not work.




this is the text inside my js file.

/**
"Trapti jewellery";
*/
Screenshot_4.png
[Thumbnail for Screenshot_4.png]
In this image, i want some text here, by js.
Screenshot_5.png
[Thumbnail for Screenshot_5.png]
This is my external js file inside js folder.
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, you need to be a bit more specific than just saying "but did not work". What didn't work? What were you expecting? What have you got?

Secondly, have you tried using the correct path delimiters? A forward slash, rather than a back slash.

Lastly, you have no JavaScript in your js file, just a comment.

Please explain what you expect to happen here?
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the image mentioned, the text is "syed jewellery", so I want "trapti jewellery " text in above of each page in my project, how is it possible?
Screenshot_6.png
[Thumbnail for Screenshot_6.png]
Likje this image.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So find where you have the text "syed jewellery" and change it to "trapti jewellery". I'm failing to see the complexity here. Perhaps you haven't explained it fully?

You mentioned JSP earlier. I think the feature you're looking for here is JSP Include which will place the contents of the 'included' file at the specified location.
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am just giving example by previous image, I want add "trapti jewellery" in my image(mentioned my image) and want "trapti jewellery" on each page in my project , like this page(mentioned my image).
Screenshot_4.png
[Thumbnail for Screenshot_4.png]
my image
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I mentioned before, I think a JSP include is what you're looking for.

Here's how it works:

index.jsp

header.jsp

Will result in the following html presented to the browser
 
Everyone is a villain in someone else's story. Especially this devious 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