• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript within JSP

 
sreekanth rach
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends!!
How can i use JavaScript Variable within JSP page..
like my requirement is, i want to use that JavaScript variable in a SQL-query (everything within JSP page)..
plz look into this..
kindly, provide me the solution at the earliest..
'am in real-need of you..
thanks in advance,to everyone..
Sree.
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript variables are accessible nowhere except Javascript code. But you can store a javascript variable's value in a HTML Form element (possibly hidden) and then access it in ur JSP
HTH
Sudharsan
 
sumana ar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai..
suppose u are having a form field username ..then use the setProperty to set a variable username suing JSP. now u can use that JSP variable in the SQL-Query as..
"select * from emp where ename ='"+usename+"'"
now emp is the table name and ename is the attribute..hope this would help u
--sumana
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic