M
Martin
Hi,
I've got a funny and wanted to know if there is a fix out there for
this.
I display a jsp inside a frame that monitors the database and reloads
itself via the setTimeout js function. To improve functionality I
added a dropdown where the user can select the frequency of reloading.
The bug is this: Let the page reload by itself. Then click on the
dropdown and do not select a value, just leave it open until the page
reloads itself. You should get a blank page. Any ideas?
** test.jsp
<%
try {
String MILLIS = request.getParameter("mills");
int millis = 15000;
if (MILLIS != null && MILLIS.equals("") == false) {
millis = Integer.parseInt(MILLIS) * 1000;
} else {
MILLIS = "15";
}
System.out.println("here...");
System.out.println("millis = " + millis);
%>
<html>
<head>
<title>Test</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" CONTENT="0">
<script>
function reload()
{
setTimeout('document.mon.submit();', <%=millis%>);
}
reload();
</script>
</head>
<body>
<%=new java.util.Date()%>
<form name="mon" class="form" >
Update this page every
<select name="mills" onchange="javascript:document.mon.submit();">
<option value="7" <% if ("7".equals(MILLIS)) { %>selected<% }
%>>7 seconds</option>
<option value="15" <% if ("15".equals(MILLIS)) { %>selected<% }
%>>15 seconds</option>
<option value="30" <% if ("30".equals(MILLIS)) { %>selected<% }
%>>30 seconds</option>
</select>
</form>
</body>
</html>
<%
System.out.println("here too...");
} catch (Exception e) {
System.out.println("e.getMessage() = " + e.getMessage());
e.printStackTrace();
}
%>
** end
Thanks,
Martin
I've got a funny and wanted to know if there is a fix out there for
this.
I display a jsp inside a frame that monitors the database and reloads
itself via the setTimeout js function. To improve functionality I
added a dropdown where the user can select the frequency of reloading.
The bug is this: Let the page reload by itself. Then click on the
dropdown and do not select a value, just leave it open until the page
reloads itself. You should get a blank page. Any ideas?
** test.jsp
<%
try {
String MILLIS = request.getParameter("mills");
int millis = 15000;
if (MILLIS != null && MILLIS.equals("") == false) {
millis = Integer.parseInt(MILLIS) * 1000;
} else {
MILLIS = "15";
}
System.out.println("here...");
System.out.println("millis = " + millis);
%>
<html>
<head>
<title>Test</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" CONTENT="0">
<script>
function reload()
{
setTimeout('document.mon.submit();', <%=millis%>);
}
reload();
</script>
</head>
<body>
<%=new java.util.Date()%>
<form name="mon" class="form" >
Update this page every
<select name="mills" onchange="javascript:document.mon.submit();">
<option value="7" <% if ("7".equals(MILLIS)) { %>selected<% }
%>>7 seconds</option>
<option value="15" <% if ("15".equals(MILLIS)) { %>selected<% }
%>>15 seconds</option>
<option value="30" <% if ("30".equals(MILLIS)) { %>selected<% }
%>>30 seconds</option>
</select>
</form>
</body>
</html>
<%
System.out.println("here too...");
} catch (Exception e) {
System.out.println("e.getMessage() = " + e.getMessage());
e.printStackTrace();
}
%>
** end
Thanks,
Martin