JavaScript 関数に引数として渡したい変数が JSP ページにあり、その方法を教えてください。
コード:-
<%
String ts=request.getParameter("testname");
session.setAttribute("tname", ts);
Connection con=null;
Statement s=null;
ResultSet r=null;
int t=60000;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:online_testing");
s=con.createStatement();
r=s.executeQuery("select * from "+ts+"");
String time=r.getString("duration");
t=Integer.parseInt(time)*60000;
}
catch(Exception e1)
{
response.setContentType("text/html");
out.println(e1.toString());
}
%>
<body onload="setTimeout('submitForm()',<%=t%>)">
更新されたものではなく、tの初期値のみを取得しています。関数 setTimeout() の変数「t」の値を引数として渡すにはどうすればよいですか?