Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet please give me solution how to display next page after 20 records ?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


bhagyashri
please give me solution how to display next page after 20 records ?
1 Answer(s)      6 years and 9 months ago
Posted in : JSP-Servlet


Java Servlet Paging control example


Advertisement
View Answers

February 25, 2008 at 6:06 PM


here i have attached one example code.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<LINK href="PCMcss.css" type=text/css rel=stylesheet>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE></TITLE>
</HEAD>
<BODY >

<SCRIPT LANGUAGE="JavaScript">

function validate()
{
for(j=0;j<30;j++){
var txtObject=document.getElementById("volume"+j);
if(txtObject!=null){
if(!isInteger(txtObject.value)){
alert("invlaide data formate only the number will be accept");
txtObject.value="";
txtObject.focus();
return;
}
}
}
}

function isInteger(s)
{ var i;
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}

return true;
}

function hideRow(type)
{
row=document.request.preRow.value;
if(type=='P'){
row=parseInt(row)-1;
if(row==-1){
document.links("pre"+document.request.preRow.value).disabled=true
return;
}
document.request.preRow.value= parseInt(row);
}
if(type=='N'){
row=parseInt(row)+1;

if(row==4){
document.links("next"+document.request.preRow.value).disabled=true
return;
}
document.request.preRow.value= parseInt(row);
}

for(i=0;i<4;i++){
if(i==row){
document.getElementById("firRow"+i).style.display=""
document.getElementById("secRow"+i).style.display=""
}else{
document.getElementById("firRow"+i).style.display="none"
document.getElementById("secRow"+i).style.display="none"
}
}

}

</SCRIPT>
</div>

<FORM METHOD=POST ACTION="" NAME="request">
<input type="hidden" name="preRow" value=0 >


<TABLE>
<TR id="firRow0">
<TD align="center"></TD>
<TD align="center">1</TD>
<TD align="center">2</TD>
<TD align="center">3</TD>
<TD align="center">4</TD>
<TD align="center">5</TD>
<TD align="center">6</TD>
<TD align="center">7</TD>
<TD align="center">8</TD>
<TD align="center">9</TD>
<TD align="center">10</TD>
<TD align="center"></TD>
</TR>
<TR id="secRow0">
<TD><INPUT TYPE="button" value="Volume" align="center"></TD>

<TD><INPUT TYPE="text" NAME="volume1" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume2" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume3" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume4" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume5" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume6" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume7" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume8" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume9" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume10" size="4" ></TD>
<TD><a href="javascript:hideRow('P')" name="pre0">previous</a></TD>
<TD><a href="javascript:hideRow('N')" name="next0">next</a></TD>
</TR>

<TR id="firRow1">
<TD align="center"></TD>
<TD align="center">11</TD>
<TD align="center">12</TD>
<TD align="center">13</TD>
<TD align="center">14</TD>
<TD align="center">15</TD>
<TD align="center">16</TD>
<TD align="center">17</TD>
<TD align="center">18</TD>
<TD align="center">19</TD>
<TD align="center">20</TD>
<TD align="center"></TD>
</TR>
<TR id="secRow1">
<TD><INPUT TYPE="button" value="Volume" align="center"></TD>

<TD><INPUT TYPE="text" NAME="volume11" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume12" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume13" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume14" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume15" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume16" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume17" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume18" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume19" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume20" size="4" ></TD>
<TD><a href="javascript:hideRow('P')" name="pre1">previous</a></TD>
<TD><a href="javascript:hideRow('N')" name="next1">next</a></TD>
</TR>

<TR id="firRow2">
<TD align="center"></TD>
<TD align="center">21</TD>
<TD align="center">22</TD>
<TD align="center">23</TD>
<TD align="center">24</TD>
<TD align="center">25</TD>
<TD align="center">26</TD>
<TD align="center">27</TD>
<TD align="center">28</TD>
<TD align="center">29</TD>
<TD align="center">30</TD>
<TD align="center"></TD>
</TR>
<TR id="secRow2">
<TD><INPUT TYPE="submit" value="Volume" align="center"></TD>

<TD><INPUT TYPE="text" NAME="volume21" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume22" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume23" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume24" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume25" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume26" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume27" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume28" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume29" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume30" size="4" ></TD>
<TD><a href="javascript:hideRow('P')" name="pre2">previous</a></TD>
<TD><a href="javascript:hideRow('N')" name="next2" >next</a></TD>
</TR>

<TR id="firRow3">
<TD align="center"></TD>
<TD align="center">31</TD>
<TD align="center">32</TD>
<TD align="center">33</TD>
<TD align="center">34</TD>
<TD align="center">35</TD>
<TD align="center">36</TD>
<TD align="center">37</TD>
<TD align="center">38</TD>
<TD align="center">39</TD>
<TD align="center">40</TD>
<TD align="center"></TD>
</TR>
<TR id="secRow3">
<TD><INPUT TYPE="submit" value="Volume" align="center"></TD>

<TD><INPUT TYPE="text" NAME="volume31" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume32" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume33" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume34" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume35" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume36" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume37" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume38" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume39" size="4" ></TD>
<TD><INPUT TYPE="text" NAME="volume40" size="4" ></TD>
<TD> <a href="javascript:hideRow('P')" name="pre3">previous</a></TD>
<TD><a href="javascript:hideRow('N')" name="next3" >next</a></TD>
</TR>

</TABLE>

<BR><BR>
<CENTER>
<input type="Button" value="Simulate" align="right" onclick="validate()" >
</CENTER>
</FORM>
</BODY>
<script>
hideRow();
</script>

</HTML>





Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com