How can I access JSP variables from a JavaScript function in a JSP page?

Respected sir How can I access JSP variables from a JavaScript function in a JSP page?Thanx
[112 byte] By [chahalkhushwindera] at [2007-11-27 8:30:57]
# 1

You may be get some help from the code below.

<%

String str="str";

%>

<script>

function accessVar(){

var varStr='<%=str%>';

alert(varStr);// here will diplay 'str'

}

</script>

anywaybeana at 2007-7-12 20:26:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
thanx a lot
chahalkhushwindera at 2007-7-12 20:26:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
When you develop a b/s application.you must know what is the server script and what is the browse script(client's script).sever script create browse script,an run at server.browse's script is run by browse!
jspNewera at 2007-7-12 20:26:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
u r right . i appreciate ur suggestion and will keep it in mind next time
chahalkhushwindera at 2007-7-12 20:26:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
that's a good method,i got it ,thx
field-zeroa at 2007-7-12 20:26:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...