By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,299 Members | 786 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,299 IT Pros & Developers. It's quick & easy.

keep track of auto refresh in jsp page

P: 34
hi,

I have designed a jsp page. This jsp is able to auto refresh after 5 second.
But i want after 5th times of auto refreshment the table present inside the body should change.

Can anybody help me out.
My code is ::


<%@ page import = "example.*, java.util.*, javax.servlet.http.*" %>

<%! int i=0;
int cnt=0;
%>
[HTML]
<html>
<head>
<title> Info </title>
<meta http-equiv="refresh" content="5;url=index.jsp">
</head>
<%
cnt++;
%>

<body bgcolor='#0cd2ff' >
<table align='center' width='50%'>
<tr><td align='center'><font color='#af0002'size='8'><h1>xxxx</h1></font></td></tr>
<tr><td align='center'><br /></td></tr>
<tr><td align='center'><font color='#af0012'size='5'>Information</font></td></tr>
</table>

<% out.println(cnt); %>
<%!
BSInfoBean bsinfobean=null;
ArrayList infolist = null;
ArrayList bsinfo = null ;
ArrayList msinfo = null;
%>
<%
bsinfobean = new BSInfoBean();
infolist = (ArrayList) bsinfobean.retrieveRecord();
bsinfo = (ArrayList) infolist.get(0);
msinfo = (ArrayList) infolist.get(1);
//response.setHeader("Refresh", 60);
%>
<table bgcolor ="#feeab1" border="1" width= "75%" align='center' id = "bsinfotable">
<tr>
<td>&nbsp</td>
<td align='center'><%=bsinfo.get(0) %> </td>
<td align='center'><%=bsinfo.get(1) %> </td>
<td align='center'><%=bsinfo.get(2) %> </td>
</tr>
<%
for(int i = 1; i<=cnt ; i++) {
%>

<tr>
<td align='center'>t<%= i %></td>
<td align='center'><%=msinfo.get(0) %> </td>
<td align='center'><%=msinfo.get(1) %> </td>
<td align='center'><%=msinfo.get(2) %> </td>
</tr>
<%
if( i == 5 ) {
break;
}
}
%>


</table>
</body>
</html>
[/HTML]
May 16 '08 #1
Share this Question
Share on Google+
1 Reply

Dököll
Expert 100+
P: 2,364
Pushing it forward:-)
Jun 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.