how to pass java variable to javascript function in jsp

Solutions on MaxInterview for how to pass java variable to javascript function in jsp by the best coders in the world

showing results for - "how to pass java variable to javascript function in jsp"
Joan
24 Jan 2017
1<% String str="Hello World"; %>
2<html>
3<head>
4<script language="javascript">
5
6function access(){
7
8var s="<%=str%>";
9alert(s);
10}
11</script>
12</head>
13<body onload="access()">
14</body>
15</html>