public int doStartTag ( ) throws JspException { log . fine ( "public int doStartTag(): called" ) ; TagUtils tagUtils = TagUtils . getInstance ( ) ; // Get a reference to the PagedList. PagedList list = ( PagedList ) tagUtils . lookup ( pageContext , name , property , scope ) ; log . fine ( "list = " + list ) ; // Work out what the URL of the action to handle the paging events is. String url ; try { url = tagUtils . computeURL ( pageContext , null , null , null , action , null , null , null , false ) ; } catch ( MalformedURLException e ) { throw new JspException ( "Got malformed URL exception: " , e ) ; } // Optionally render the first page button. renderButton ( renderFirst , 0 , 0 , openDelimFirst , url , firstText , list . getCurrentPage ( ) != 0 ) ; // Optionally render the back button. renderButton ( renderBack , list . getCurrentPage ( ) - 1 , ( ( list . getCurrentPage ( ) - 1 ) < list . getCurrentIndex ( ) ) ? ( list . getCurrentIndex ( ) - maxPages ) : list . getCurrentIndex ( ) , openDelimBack , url , backText , ( list . getCurrentPage ( ) - 1 ) >= 0 ) ; // Render links for pages from the current index to the current index plus the maximum number of pages. int from = list . getCurrentIndex ( ) ; int to = list . getCurrentIndex ( ) + maxPages ; for ( int i = from ; ( i < list . size ( ) ) && ( i < to ) ; i ++ ) { renderButton ( true , i , list . getCurrentIndex ( ) , ( i == list . getCurrentPage ( ) ) ? openDelimCurrent : openDelimNumber , url , "" + ( i + 1 ) , i != list . getCurrentPage ( ) ) ; } // Optionally render a more button. The more button should only be rendered if the current index plus // the maximum number of pages is less than the total number of pages so there are pages beyond those that // have numeric link to them already. renderButton ( ( list . getCurrentIndex ( ) + maxPages ) < list . size ( ) , list . getCurrentPage ( ) + maxPages , list . getCurrentPage ( ) + maxPages , openDelimMore , url , moreText , true ) ; // Optionally render a forward button. renderButton ( renderForward , list . getCurrentPage ( ) + 1 , ( ( list . getCurrentPage ( ) + 1 ) >= ( list . getCurrentIndex ( ) + maxPages ) ) ? ( list . getCurrentIndex ( ) + maxPages ) : list . getCurrentIndex ( ) , openDelimForward , url , forwardText , ( list . getCurrentPage ( ) + 1 ) < list . size ( ) ) ; // Optionally render a last page button. renderButton ( renderLast , list . size ( ) - 1 , ( list . size ( ) / maxPages ) * maxPages , openDelimLast , url , lastText , list . getCurrentPage ( ) != ( list . size ( ) - 1 ) ) ; return SKIP_BODY ; }
Renders the paging control .