
I am doing MCA project work. I am new in ejb and struct. i m using sql server 2005,jsp, ejb module, action classes and struct, i have a table which contains ID and Name, i want show next names using next button and prev name using prev button. prev button will not work first name and in last name next button will no work. please help me.

This is my jsp code;
<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ page import="java.util.ArrayList" %>
<%
HttpSession rs = request.getSession();
String selectedid = (String) rs.getAttribute("selectedid");
%>
<body>
<h1><font size="6" color="#006699">WISDOM-2</font></h1>
<br><br>
<table id="thetable" width="100%" cellspacing="0" summary="Details" cellpadding="0" cellspacing="0" class="rowstyle-alt paginate-20">
<caption><font size="4">Test Name</font></caption>
<thead><tr>
<th scope="col" abbr="ID">ID</th>
<th scope="col" abbr="Name">Name</th>
</tr>
</thead>
<%
ArrayList al = (ArrayList) rs.getAttribute("gettestname");
ArrayList subal = null;
if (al != null) {
int i = 0;
//for (int i = 0; i < al.size(); i++) {
subal = (ArrayList) al.get(i);
if (subal.get(0).toString().equals("No Data")) {%>
<tr><td>No Data found</td></tr>
<% } else {%>
<tr>
<td><%=subal.get(0).toString().trim()%></td>
<td><%=subal.get(1).toString().trim()%></td>
</tr>
<% }
}
%>
</table>
<br><br><br><br>
<center>
<input type="button" name="prev" value="<< Prev" onclick="change();">
<input type="button" name="next" value="Next >>" onclick="change();">
</center>
<form name="f2" action="<%=request.getContextPath()%>/gettestname.do" method="post">
</form>
<script>
function change()
{
document.f2.submit();
}
</script>
</body>