• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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.
 
Marshal
Posts: 5409
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
Marshal
Posts: 5409
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
Marshal
Posts: 5409
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
 
You get good luck from rubbing the belly of a tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic