• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can ot read values from JSP iun JavaScript  RSS feed

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • 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
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!