Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to assign javascript variable value to a jsp variable  RSS feed

 
srihari miriyala
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

how to assign javascript variable value to a jsp variable?

i 've following code





in this i am getting alert as


"some data from the class NewClass +YYYYYYYYY"

instead of "some data from the class NewClass +XXXXXXXX"

please help me in this scenario.
 
amir taghvayi
Ranch Hand
Posts: 54
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

Note: javascript is client side and jsp iس server side .
you زan not assign javascript variable value to a jsp variable .

Possible ways :
  • send v as a parameter to jsp then get with ${param['v']}
  • directly set name = "XXXXXXXX"




  •  
    Bear Bibeault
    Author and ninkuma
    Marshal
    Posts: 66187
    151
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Impossible, unless you can invent a time machine. The JSP code runs long before the page gets sent to the browser where the JavaScript can be evaluated.

    Please read this article to understand what JSP is.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!