Ok, so I have a jsp web page that shows me what are the courses that I am registered to. the jsp code that is performed in the begining of the page:
<div>
<%
String username = request.getUserPrincipal().getName();
Iterable<Course> avCourses = ORM.getAvailableCourses(username);
%>
</div>
<form id="avCoursesForm">
<fieldset>
<legend>Available courses: </legend>
<table class="coursesTable">
<tr id="firstTr" style="display: none;">
<td class="blueBorder" style="width:5%;"></td>
<td class="blueBorder" style="width:20%;"><b>Course name</b></td>
<td class="blueBorder" style="width:15%;"><b>Course id</b></td>
<td class="blueBorder" style="width:5%;"><b>Credit points</b></td>
<td class="blueBorder" style="width:10%;"><b>Group number</b></td>
</tr>
<%
Iterator<Course> iter = avCourses.iterator();
int size = 0;
while(iter.hasNext())
{
Course course = iter.next();
%>
<tr id="trOfTable<%=size%>" style="display: none;">
<td class="blueBorder" style="width:5px;">
<input type="checkbox" name="option" value="<%=course.courseName%>" />
</td>
<td class="blueBorder">
<a href=# onclick="getPage('<%=request.getContextPath() %>', '<%=course.courseName %>');">
<%=course.courseName%> </a>
</td>
<td class="blueBorder">
<%=course.courseId%>
</td>
<td class="blueBorder">
<%=course.creditPoints%>
</td>
<td class="blueBorder">
<%=course.groupNum%>
</td>
</tr>
<%
size++;
}
%>
</table>
</fieldset>
</form>
the function getAvailableCourses() is at ORM.java file (this file queries the DB).
My goal is to check the database every X seconds to see if a certain course is still available for registration. I don't know how to do that. Can you help me? In other words, I want to asynchronously check the database and accordingly refresh parts of the page (unavailable course will disappear and new available courses will appear).
tnx, Itamar.