Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Total

Status
Not open for further replies.

extempore

Programmer
Jun 1, 2001
71
US
Hi all,

I have created jsp pages which dynamically diplays 9 pictures per page. Now the user wants to have something like (Pic 1-9 of 48 Total) on the page. Can someone tell me how I can do this.

I have <%=pageIndex%> (starts with 0) which gives me the page I am currently on and <%=size%> (48 in this example) the total no of pics.

For e.g if <%=pageIndex%> is 0 then the text should day (Pic 1-9 of 48 Total)

if <%=pageIndex%> is 1 then the text should day (Pic 10-18 of 48 Total)

if <%=pageIndex%> is 2 then the text should day (Pic 19-28 of 48 Total)

Since the <%=pageIndex%> changes based on pagination and the <%=size%> being the same, can someone tell me if this can be achieved through Javascript?

Thanks and regards.
 
<%
int start=(pageIndex+(pageIndex*9));
if(start==0)
start=1;
out.println(start+&quot; to &quot;+(start+9)+ &quot;of &quot;+size+&quot; Total&quot;);
%>

Known is handfull, Unknown is worldfull
 
could you just do something lke a switch statement to write your whole deal? how do you use jsp variables withing javascript? can they just be referred to the same. like could you do something like:

switch (pageIndex) {
case &quot;1&quot;:
var statusP = &quot;Pic 1-9 of &quot;+size+&quot; Total.&quot;
break;

...............

}


then later

document.write(statusP)
 
Thanks for the idea...did use yours modified it a little bit and I am good to go. Thanks again.
 
may i know whose method u used?

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top