I've this servlet that reads the data from db and then passes on a sublist of the data retrieved from db to the jsp page...

package tryjsp;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class GetReleaseDataServlet extends HttpServlet {
	String releaseno = ""; 
	String location = "";
	int startIndex = 0;
        int count = 0;
	int increment = 1;
	int numRows = 0;
	int numPages = 0;
	int numRecordsPerPage = 2;
	

	public void doGet(HttpServletRequest request, HttpServletResponse response)
	        throws ServletException, IOException
	{
		releaseno = request.getParameter("releaseno"); 
		location = request.getParameter("location");
		String startIndexString = request.getParameter("start");
		if(startIndexString == null) {
			startIndexString = "1";
		}
		startIndex = Integer.parseInt(startIndexString);
		
		HttpSession session = request.getSession();		
		response.setContentType("text/html");
		ReleaseDataDAO myDAO = new ReleaseDataDAO(); 
		List<ReleaseData> myDataList = myDAO.getReleaseData(releaseno,location);
		List<String> versionsList = myDAO.getVersions();

 		numRows = myDataList.size(); 
		numPages = numRows /numRecordsPerPage ;
		int remain = numRows % numRecordsPerPage ;
		
		if(remain != 0){
			//to display remainder rows
			numPages = numPages +1 ;
		} 
		if((startIndex + numRecordsPerPage) <= numRows) {
			increment = startIndex + numRecordsPerPage ;
		}
		else{                                                   
			if (remain == 0){
				increment = startIndex + numRecordsPerPage ;
			}else{
				increment = startIndex + remain;
			}
		}

		List<ReleaseData> subDataList = new ArrayList<ReleaseData>();
		for(count = startIndex; count < increment; count++) {
			subDataList.add(myDataList.get(count-1));
		}

       		session.setAttribute("numRows", numRows);  
		request.setAttribute("releaseno",releaseno);
		request.setAttribute("location",location);
		request.setAttribute("versionsList", versionsList);		
		request.setAttribute("myDataList", subDataList);
		request.setAttribute("startIndex",startIndex);
		request.setAttribute("numRecordsPerPage", numRecordsPerPage);
		request.setAttribute("increment", increment);
		request.getRequestDispatcher("showReleaseData.jsp").forward(request, response);
	}
}

The jsp page displays the data received (in var "myDataList") from servlet into a table. It also displays a "Prev" or "Next" link, clicking on these links recalculates the startIndex, this index is then used to generate a new sublist in the servlet.

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>

  Please choose <BR>
  <form method=get action="getReleaseData">
  <select name=releaseno>
    <option>
         All
    </option>
    <c:forEach var="item" items="${versionsList}">
      <option>
         <c:out value="${item}" />
      </option>
    </c:forEach>
  </select>
  <select name=location>
    <option>
         All
    </option>
    <option>
         Hyd
    </option>
    <option>
         Dub
    </option>
    <option>
         Mtv
    </option>
  </select>
  <input type="submit" value="Select"> 
  </form> 


  Your search results matching Releaseno: ${releaseno} and Location: ${location}<BR>
  <table border="1">
    <c:forEach items="${myDataList}" var="releaseData">
     .
     .
     .
    </c:forEach>
  </table>
  
  <table width = "100%">
  <tr>
  Displaying Records: ${startIndex},${startIndex+numRecordsPerPage-1}
  
  <c:if test="${startIndex ne 1}">
    <c:set var="startIndex" value="${startIndex-numRecordsPerPage}"/>
    <td align="center"><a href="/getReleaseData">Previous</a></td>
  </c:if>
  <c:set var="temp" value="${startIndex + numRecordsPerPage}"/>
  <c:if test="${temp le numRows}">
    <c:set var="startIndex" value="${startIndex+numRecordsPerPage}"/>
    <td align="center"><a href="/getReleaseData">Next</a></td>
  </c:if>
  </tr>
  </table>
</body>
</html>

Here is the issue:
Look at the link I provided for the Prev/Next in my jsp page, I gave url of my servlet. As I want to go back to my servlet with the new value of startIndex and generate the new subList. But when I click on Next link, I get "The requested resource (/getReleaseData) is not available.".

Can you please tell me how can I direct control to my servlet from jsp page. Please help.

> But when I click on Next link, I get "The requested resource (/getReleaseData) is not
> available.".

Take a look at the link which is displayed in the location bar of your web browser. Is path shown there same as that the location at which your servlet is present?