I am using a spring mvc controller. Inside controller i am putting some value lets say string inside model. Now i would like to retrive that value or lets just say print tha
Use this:
var movie_name = "${movie}";
instead of:
var movie_name = ${movie};
When using ${movie}
, the value gets placed on the page without quotes. Since I'm guessing it's a string, Javascript requires strings be surrounded by quotes.
If you checked your browser's console, you probably would've seen an error like Unexpected identifier
or ___ is not defined
.