Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

we are not getting from previous page to next page and did not display the data using JSPS

 
mallika mallikaa
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

we have developed one portal in which we need to view the data from one page to another page but we are getting error like java.lang.NullPointerException

we are using below code

if ( test1 == 'first') { document.reportForm.mode.value='First'; }
if ( test1 == 'previous') { document.reportForm.mode.value='Previous'; }
if ( test1 == 'next'){ document.reportForm.mode.value='Next';}
if ( test1 == 'last') { document.reportForm.mode.value='Last'; }



<TR>
<TD ALIGN=CENTER>

<INPUT TYPE=BUTTON value="First" onClick="check('first','<%=circle%>','<%=month1%>','<%=year1%>')";>    
<INPUT TYPE=BUTTON value="Previous" onClick="check('previous','<%=circle%>','<%=month1%>','<%=year1%>')";>    
<INPUT TYPE=BUTTON value="Next" onClick="check('next','<%=circle%>','<%=month1%>','<%=year1%>')";>    
<INPUT TYPE=BUTTON value="Last" onClick="check('last','<%=circle%>','<%=month1%>','<%=year1%>')";>

<input type=hidden name="mode" >
<input type=hidden name="test">
</TD>
</TR>
<%--<a href="reports.jsp"><strong>Go To Reports?</strong></a>--%><br> <br>


try
{
rs.last();
noofRows=rs.getRow();
int total_rows=rs.getRow();
session.setAttribute("total_rows",total_rows);
rs.beforeFirst();
}
catch(Exception e) {out.println(e);}

int remRows=noofRows%20;
int LastPage=(noofRows-remRows)/20;

if (remRows>0)
{
LastPage++;
}

try
{

if (request.getParameter("mode").equals("Previous"))
{pageNo--;}
if (request.getParameter("mode").equals("Next"))
{
pageNo++;
if (pageNo>LastPage)
{
pageNo=LastPage;
}
}
if (request.getParameter("mode").equals("Last")) { pageNo=LastPage;}
if (request.getParameter("mode").equals("First")) { pageNo=1;}
} catch(Exception e) { pageNo++;}

if (pageNo<=0) {pageNo=1;}

pageNo=pageNo;
toRows=pageNo*20;
out.println("Rows" +noofRows);

if (toRows > noofRows ) { gm= noofRows; } else { gm=pageNo*20; }
fromRows=toRows-20;
%>

<input type="hidden" name="mode1" />
<input type="hidden" name="pageNo" value="<%=pageNo%>"/>
<input type="hidden" name="test1"/>

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic