Results 1 to 5 of 5
  1. #1
    pateldpk is offline Member
    Join Date
    Apr 2012
    Posts
    27
    Rep Power
    0

    Default Auto refresh in jsp..

    How to auto refresh table inside JSP....
    here is the code:-

    Java Code:
    <%@ page import="java.sql.*" %>
     
    
    <%
    	try{
    	String driver="sun.jdbc.odbc.JdbcOdbcDriver";
    	Class.forName(driver);
    	String url="jdbc:odbc:trial";
    	Connection con=DriverManager.getConnection(url);
    	Statement st=con.createStatement();
    	String sql=("SELECT * FROM signup");
    	ResultSet rs=st.executeQuery(sql);
    %>
    
    <html>
    <head>
    <title>admin page</title>
    </head>
    <center>
    <div STYLE="background:gray; font: 26pt/30pt courier; font-variant: small-caps; border: thick dashed blue 3px; border-radius:10px; margin-left:300px;margin-right:300px;">
    <h2>you'r most welcome to admin page</h2>
    </div>
    </br>
    <h3><b>User Information</b></h3>
    <table border="1" height=50 width=350 style="border-radius:10px;">
    <tr><td style="border-radius:10px;"><center>FIRSTNAME</center></td>
    <td style="border-radius:10px;"><center>LASTNAME<center></td>
    <td style="border-radius:10px;"><center>EMAIL<center></td>
    <td style="border-radius:10px;"><center>PASSWORDF<center></td>
    <td style="border-radius:10px;"><center>SECRETWORD<center></td></tr>
    <%
    	while(rs.next()){
    
    %>
    <tr><td><%=rs.getString("FIRSTNAME")%></td>                   
    <td><%=rs.getString("LASTNAME")%></td>
    <td><%=rs.getString("EMAIL")%></td>
    <td><%=rs.getString("PASSWORD")%></td>
    <td><%=rs.getString("SECRETWORD")%></td></tr>
    <%
    }
    %>
    <%
    }catch(Exception ex){}
    %>
    </table>
    </center>
    </html>

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: Auto refresh in jsp..

    Use Javascript and Ajax calls to a servlet that provides the data to stick in the table?

    That's how I'd do it anyway.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    pateldpk is offline Member
    Join Date
    Apr 2012
    Posts
    27
    Rep Power
    0

    Default Re: Auto refresh in jsp..

    Ok... but i dont know Ajax.. can you give me the code example to refresh it..?

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,037
    Rep Power
    10

    Default Re: Auto refresh in jsp..

    Quote Originally Posted by pateldpk View Post
    Ok... but i dont know Ajax.. can you give me the code example to refresh it..?
    Sounds like a job for google to me.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: Auto refresh in jsp..

    The other option is to simply reload the entire page.
    A bit clunky in this day and age, but it might be OK for your needs.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Auto Refresh a Java Popup Page?
    By lokerd in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-07-2011, 07:46 PM
  2. Auto contrast and auto brightness
    By oxxxis in forum Java 2D
    Replies: 0
    Last Post: 01-21-2010, 09:32 PM
  3. JSP Auto Log -In
    By Eku in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 09-18-2008, 04:58 AM
  4. Auto-complete/Auto-fix for custom statement
    By dark_cybernetics in forum Eclipse
    Replies: 0
    Last Post: 08-19-2008, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •