hello everybody
my problem is that i am execute a database query on a
jsp page and want's to send this value to a
java script function.
after that i want to access this value at java script function and wants to perform some operation over that value
i am also giving a sample code of my project idea.
the jsp part:
<html>
<body>
<form name="form1" method="post" action="">
<p>
<input type="text" name="textfield">
</p>
<%
try
{
Connection con=null;
ResultSet rs=null;
Statement stmt=null;
String nam=request.getParameter("textfield");
Class.forName("com.mysql.jdbc.Driver");
con = java.sql.DriverManager.getConnection("jdbc:mysql:///name",
"root","");
stmt= con.createStatement();
rs=stmt.executeQuery("select city from login where name='"+nam+"'");
String NameOfVariable=rs.getString(1);
%>
<p>
<input type="submit" name="Submit" value="Submit" >
</p>
</form>
</body>
</html>
i want to pass the value of NameOfVariable to javascript function valid()
the script part:
<script type="text/javascript">
function valid()
{
}
</script>
is that possible?
if yes then please tell me how
thankx
:abhishek paliwal