File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JavaScript within JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JavaScript within JSP" Watch "JavaScript within JSP" New topic

JavaScript within JSP

sreekanth rach

Joined: Jan 02, 2003
Posts: 14
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..
Sudharsan Govindarajan
Ranch Hand

Joined: Jul 03, 2002
Posts: 319
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
sumana ar

Joined: Aug 06, 2003
Posts: 28
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
I agree. Here's the link:
subject: JavaScript within JSP
It's not a secret anymore!