This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JSP and the fly likes To get total number of pages in Java script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "To get total number of pages in Java script" Watch "To get total number of pages in Java script" New topic
Author

To get total number of pages in Java script

N. Ganapathy
Greenhorn

Joined: Apr 16, 2012
Posts: 25


How to find the total number of pages in java script . Kindly let me know how to achieve it.

Thanks in advance.
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Can you elaborate what all you tried and how exactly you are trying so that we can understand your requirement ?

Is it simply to fetch total Count / Per Page records = total pages (Can be done by Ajax call to get DB call and return final total number of pages ) .
N. Ganapathy
Greenhorn

Joined: Apr 16, 2012
Posts: 25

Karn Kumar wrote:Can you elaborate what all you tried and how exactly you are trying so that we can understand your requirement ?

Is it simply to fetch total Count / Per Page records = total pages (Can be done by Ajax call to get DB call and return final total number of pages ) .


Dear Karn,

We are uploading a pdf file from client side. Actually we need to the find the total number of pages of the document based on which the user will decide whether the file has to be uploaded or not.

Instead passing it to the another jsp file and calculating the pagenumber, we need to handle this in the same java script file itself.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42956
    
  73
What are you counting? What constitutes a page?

Edit after seeing your reply: Javascript has no access to client - side files. You'll have to do this on the server.
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Are you sure that you will let user upload the file based on the Pages ? Or you have some some size limit for uploaded file ? If that is Size which matters then you look for javascript code , what Ulf suggested is good .
 
Consider Paul's rocket mass heater.
 
subject: To get total number of pages in Java script
 
It's not a secret anymore!