• 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Information from JSP to javascript  RSS feed

 
Ranch Hand
Posts: 207
2
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Right now what I have set seems hacky so I was wondering if maybe there's a better way to solve this problem other than completely changing the design.

I'm getting information that's put in by a JSP to be used in a JS map library.

I put the information I need in a hidden html tag via EL  like this:
<p hidden> ${hey.whatsup}</p>
Then I use the values how I need in JS.

Is this hacky or what?

AA
 
Author and ninkuma
Marshal
Posts: 66786
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hacky. Why not just create real JS constructs?
 
Al Hobbs
Ranch Hand
Posts: 207
2
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by real JS contructs? Like getting the info with a call to a rest endpoint?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66786
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Why put the data in a fake element for JS to extract when you can just put it in the script itself?

E.g.
 
Al Hobbs
Ranch Hand
Posts: 207
2
Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oooo I see now.  Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!