My tables are populated using jsp scriptlets. Displaying is not a problem but when I do a submit which will do an add on the DB. I want my table to reload the new result on the table, but I think because I'm using jsp scriptlet I may have to reload the whole page but I don't want to do that, is there a way I could refresh/reload my table with the new result?
<%
List<Person> list = Function.doQueryFromDB();
for(Person person : list)
{ %>
<TR>
<TH ><%=person.getName()%><B></B></FONT>
</TR>
<%
}
%>
</table>
<%
List<Person> list = Function.doQueryFromDB();
pageContext.setAttribute("person", list);
%>
<table id="sampTable">
<c:forEach var="per" items="${person}">
<tr>
<td><c:out value="${per.name}" /></td>
</tr>
</c:forEach>
</table>
Just rearrange the business code so that the data is loaded from the DB after the new row is inserted.