Entry
How can we assign JSP variables to Java Script Variables
Jul 8th, 2008 05:06
Joe jack, suresh kc, Mythreyi Vattikuti, suresh kc
put something like in your jsp file
<%@ page language="java"%>
<%
//JSP Code
String name = request.getParameter("name");
if (name == null) {
name = "no parameter passed";
}
%>
<script language="javascript">
var name;
name = "<%=name%>";
alert(name);
</script>
this will display the value of the name parameter that you pass to your jsp
file. Of course, you can do something better with the variable, here I just
use the alert function to display it back to user.
http://mundoguiadeviajes.blogspot.com/