• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Can ot read values from JSP iun JavaScript

 
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following is Javascriptfragment

Below is JSP fragment setting this value



When I am running this code, in the alert I am getting alert messsage as
hi <%= alternateLocaleDCR %>

Why is expression not getting evaluated in this JS code ? Why am I not getting value of hasLocale variable set as "yes" ?
Please let me know, whats wrong here ?

Thanks
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's wrong here?

Apart from your use of scriptlets?

Remember the order that things run in.

Java/JSP runs, and produces an HTML page.
Javascript starts running when the HTML page reaches your browser.

I would suggest you do a view source on this page to take a look at what the JSP has generated for the javascript to execute.

Where does the javascript fragment get evaluated in relation to the JSP fragment?

The outcome you are seeing seems to indicate that the JSP interpreter is not run on your javascript fragment. Is that javascript fragment in a JSP file or something else?
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic