keep track of auto refresh in jsp page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BibhuAshish
    New Member
    • Oct 2007
    • 34

    keep track of auto refresh in jsp page

    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.h ttp.*" %>

    <%! 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='#0cd2f f' >
    <table align='center' width='50%'>
    <tr><td align='center'> <font color='#af0002' size='8'><h1>xx xx</h1></font></td></tr>
    <tr><td align='center'> <br /></td></tr>
    <tr><td align='center'> <font color='#af0012' size='5'>Inform ation</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.retr ieveRecord();
    bsinfo = (ArrayList) infolist.get(0) ;
    msinfo = (ArrayList) infolist.get(1) ;
    //response.setHea der("Refresh", 60);
    %>
    <table bgcolor ="#feeab1" border="1" width= "75%" align='center' id = "bsinfotabl e">
    <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]
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Pushing it forward:-)

    Comment

    Working...