Ok,

the attached patch does this, but it also does what is described at:

https://sourceforge.net/tracker/index.php?func=detail&aid=695731&group_id=73068&atid=536615

and one more thing I've not yet described (it's a cumulative patch of all improvements I've made so far that have not yet made in).

See if you like it...

Zorzella

Luiz-Otavio Zorzella wrote:
I don't think the system should ever balk at that kind of stuff...

Another circumstance this may happen is if the data is erased from the DB after you get a page, then you hit another page...

Right now, there is even an "if" for the "exceptional case" that the collection returned is empty (thus it would not even have a first page, you see?).

I think I should just set the current page to be the last page if it's more than the number of pages... And to be the first if it's negative... why not? Let's do kind of like google:

http://www.google.com/search?q=test&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10000000000000000000&sa=N


http://www.google.com/search?q=test&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=-1&sa=N



I'll do it by tomorrow.


Zorzella

Dave Hodson wrote:

I'm using .8 version of the display tag with Tomcat 4.0.3 and everything works properly

Recently, I upgraded to Tomcat version 4.1.18 and have noticed that the paging functionality does not work properly. For example, I create a table that has 8 pages by selecting a valid date range in an HTML popup. Upon the initial display of the the table, Page 1 is shown. I then click on Page 6, which is displayed properly. Next I modify my date range so that the resulting table consists of only 2 pages. This crashes with the msg

"Invalid page (6) provided, value should be between 1 and 2'"

Digging around, it turns out that Tomcat 4.1.18 no longer calls the reset() method between calls and this effectively leaves the value "pageNumber" at 6 the next time a user hits the screen (the gory details about the Tomcat bug are at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16001) This bug has been marked INVALID, so I don't think it will be fixed anytime soon.

Has anyone seen this problem and/or is there a fix for this? Seems like the thing to do is call the reset() method in the doStartTag() method, before the request object is obtained. Something like

columns = new ArrayList( 10 );
reset(); <------ add it here
HttpServletRequest req = (HttpServletRequest)this.pageContext.getRequest();


Thoughts?

Dave







-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? You could win a Tablet PC. Get a free Tablet PC hat just for playing. What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel






-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? You could win a Tablet PC. Get a free Tablet PC hat just for playing. What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Index: src/org/apache/taglibs/display/SmartListHelper.java
===================================================================
RCS file: 
/cvsroot/displaytag/displaytag/src/org/apache/taglibs/display/SmartListHelper.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 SmartListHelper.java
--- src/org/apache/taglibs/display/SmartListHelper.java 4 Feb 2003 01:35:36 -0000      
 1.1.1.1
+++ src/org/apache/taglibs/display/SmartListHelper.java 19 Mar 2003 23:54:04 -0000
@@ -8,7 +8,7 @@
 
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
 import java.util.Properties;
 
 /**
@@ -22,7 +22,7 @@
 
 class SmartListHelper extends Object
 {
-   private List masterList;
+   private Collection masterList;
    private int pageSize;
    private int pageCount;
    private int currentPage;
@@ -35,7 +35,7 @@
     * into bite size pieces that are suitable for display.
     */
 
-   protected SmartListHelper( List list, int pageSize, Properties prop )
+   protected SmartListHelper( Collection list, int pageSize, Properties prop )
    {
       super();
 
@@ -100,7 +100,7 @@
     * should appear on the given page.
     */
 
-   protected int getFirstIndexForPage( int page )
+   public int getFirstIndexForPage( int page )
    {
       return ( ( page - 1 ) * this.pageSize );
    }
@@ -122,51 +122,19 @@
 
 
    /**
-    * Returns a subsection of the list that contains just the elements that
-    * are supposed to be shown on the current page the user is viewing.
-    */
-
-   protected List getListForCurrentPage()
-   {
-      return this.getListForPage( this.currentPage );
-   }
-
-
-   /**
-    * Returns a subsection of the list that contains just the elements that
-    * are supposed to be shown on the given page.
-    */
-
-   protected List getListForPage( int page )
-   {
-      List list = new ArrayList( this.pageSize + 1 );
-
-      int firstIndex = this.getFirstIndexForPage( page );
-      int lastIndex = this.getLastIndexForPage( page );
-
-      for( int i = firstIndex; i <= lastIndex; i++ ) {
-         list.add( this.masterList.get( i ) );
-      }
-
-      return list;
-   }
-
-
-   /**
     * Set's the page number that the user is viewing.
     *
     * @throws IllegalArgumentException if the page provided is invalid.
     */
 
-   protected void setCurrentPage( int page )
+   protected int setCurrentPage( int page )
    {
-      if( page < 1 || page > this.pageCount ) {
-         Object[] objs = {new Integer( page ), new Integer( pageCount )};
-         throw new IllegalArgumentException(
-            MessageFormat.format( prop.getProperty( "error.msg.invalid_page" ), objs 
) );
-      }
-
+      if (page < 1)
+          page = 1;
+      else if (page > this.pageCount) 
+          page = this.pageCount;
       this.currentPage = page;
+      return page;
    }
 
 
@@ -278,8 +246,12 @@
             msg += "[<a href=\"" + form.format( objs ) + "\">" +
                prop.getProperty( "paging.banner.prev_label" ) + "</a>] ";
          }
+
       }
 
+      if (startPage > 1)
+         msg += "... ";
+
       for( int i = startPage; i <= endPage; i++ ) {
          if( i == currentPage ) {
             msg += "<b>" + i + "</b>";
@@ -296,6 +268,8 @@
          }
       }
 
+      if (endPage != pageCount)
+         msg += "... ";
       if( currentPage == pageCount ) {
       if( includeFirstLast ) {
             msg += "[" + prop.getProperty( "paging.banner.next_label" ) +
Index: src/org/apache/taglibs/display/TableTag.java
===================================================================
RCS file: /cvsroot/displaytag/displaytag/src/org/apache/taglibs/display/TableTag.java,v
retrieving revision 1.4
diff -u -r1.4 TableTag.java
--- src/org/apache/taglibs/display/TableTag.java        24 Feb 2003 19:37:15 -0000     
 1.4
+++ src/org/apache/taglibs/display/TableTag.java        19 Mar 2003 23:54:07 -0000
@@ -135,11 +135,14 @@
    private String name = null;
    private String property = null;
    private String length = null;
+   private String cropCollection = null;
    private String offset = null;
    private String scope = null;
    private String pagesize = null;
    private String decorator = null;
    private String export = null;
+    private String pagingParamName = "page";
+
 
 
    private String width = null;
@@ -197,6 +200,12 @@
    }
 
 
+   public void setCropCollection( String v )
+   {
+       this.cropCollection = v;
+   }
+
+
    public void setOffset( String v )
    {
       this.offset = v;
@@ -227,6 +236,11 @@
    }
 
 
+    public void setPagingParamName (String pagingParamName)
+    {
+       this.pagingParamName = pagingParamName;
+    }
+    
    public void setWidth( String v )
    {
       this.width = v;
@@ -340,6 +354,25 @@
    }
 
 
+   public boolean getCropCollectionAsBoolean()
+   {
+       String v = getCropCollection ();
+       if (
+           ( v != null) &&
+           (
+            (v.equals ("false")) || (v.equals ("no"))
+            )
+           )
+           return false;
+       return true;
+   }
+    
+
+   public String getCropCollection()
+   {
+      return this.cropCollection;
+   }
+
    public String getOffset()
    {
       return this.offset;
@@ -369,7 +402,11 @@
       return this.export;
    }
 
-
+    public String getPagingParamName ()
+    {
+       return pagingParamName;
+    }
+    
    public String getWidth()
    {
       return this.width;
@@ -610,15 +647,19 @@
       this.loadDefaultProperties();
 
       this.pageNumber = 1;
-      if( req.getParameter( "page" ) != null ) {
-         this.pageNumber = 1;
-         try {
-            this.pageNumber = Integer.parseInt( req.getParameter( "page" ) );
-         } catch( NumberFormatException e ) {
-            // It's ok to ignore, if they give us something bogus, we default
-            // to showing the first page (index = 1)
-         }
-      }
+      String param = null;
+      if (req.getParameter( getPagingParamName () ) != null )
+         param = req.getParameter( getPagingParamName ());
+      else if (req.getAttribute( getPagingParamName () ) != null ) 
+         param = req.getAttribute ( getPagingParamName ()).toString ();
+
+      if (param != null) 
+         try {
+             this.pageNumber = Integer.parseInt( param ) ;
+         } catch( NumberFormatException e ) {
+             // It's ok to ignore, if they give us something bogus, we default
+             // to showing the first page (index = 1)
+         }
 
       if( req.getParameter( "sort" ) != null ) {
          this.sortColumn = 0;
@@ -785,7 +826,7 @@
    {
       List viewableData = new ArrayList();
 
-      // Acquire the collection that we are going to iterator over...
+      // Acquire the collection that we are going to iterate over...
 
       Object collection = this.list;
 
@@ -836,8 +877,10 @@
       // refactored and moved somewhere else).
 
       // Load our table decorator if it is requested
-      this.dec = this.loadDecorator();
-      if( this.dec != null ) this.dec.init( this.pageContext, collection );
+      if (this.dec == null) {
+         this.dec = this.loadDecorator();
+         if( this.dec != null ) this.dec.init( this.pageContext, collection );
+      }
 
       if( !prop.getProperty( "sort.behavior" ).equals( "page" ) ) {
          // Sort the total list...
@@ -857,51 +900,49 @@
 
       // If they have asked for an subset of the list via the offset or length
       // attributes, then only fetch those items out of the master list.
-
+      
       int offsetValue = this.getOffsetValue();
       int lengthValue = this.getLengthValue();
-
-      for( int i = 0; i < offsetValue; i++ ) {
-         if( iterator.hasNext() ) {
-            iterator.next();
-         }
-      }
-
-      int cnt = 0;
-      while( iterator.hasNext() ) {
-         if( lengthValue > 0 && ++cnt > lengthValue ) {
-            break;
-         }
-         viewableData.add( iterator.next() );
-      }
-
-      // If they have asked for just a page of the data, then use the
-      // SmartListHelper to figure out what page they are after, etc...
-
+      
+      // Offset/length and paging are mutually exclusive
       int pagesizeValue = this.getPagesizeValue();
+      
       if( pagesizeValue > 0 ) {
-         if (! (collection instanceof List) )
-             throw new JspException( "Paging is not available for collections of type 
'" + collection.getClass() + "'.");
-         helper = new SmartListHelper( (List)collection, pagesizeValue, this.prop );
-         // tlaw 12-10-2001
-         // added the if/else statement below to allow sending an empty list to
-         // this part of the program.  seems to work.
-         // the statement inside the if is still needed by this program.
-         // everything else can be removed.
-         if( ( (List)collection ).size() > 0 ) {
-            helper.setCurrentPage( this.pageNumber );
-         }
-         iterator = helper.getListForCurrentPage().listIterator();
-
-         viewableData.clear();
-         while( iterator.hasNext() ) {
-            if( lengthValue > 0 && ++cnt > lengthValue ) {
-               break;
-            }
-            viewableData.add( iterator.next() );
-         }
+          if (! (collection instanceof Collection) )
+              throw new JspException( "Paging is not available for collections of 
type '" + collection.getClass() + "'.");
+          
+          helper = new SmartListHelper( (Collection) collection, pagesizeValue, 
this.prop );
+          
+          this.pageNumber = helper.setCurrentPage( this.pageNumber );
+          
+          offsetValue = helper.getFirstIndexForPage(this.pageNumber);
+          lengthValue = pagesizeValue;
+          
       }
 
+      boolean crop = getCropCollectionAsBoolean ();
+      
+      // We'll crop the collection based on offset/length or the page
+      // number/pagesize unless the user specified cropCollection="false".
+      if (crop) 
+          for( int i = 0; i < offsetValue; i++ ) {
+              if( iterator.hasNext() ) {
+                  iterator.next();
+              }
+          }
+      
+      
+      int cnt = 0;
+      while( iterator.hasNext() ) {
+          // When lengthValue is 0, it means the entire collection.
+          // We'll crop the collection based on offset/length or the page
+          // number/pagesize unless the user specified cropCollection="false".
+          if( lengthValue > 0 && crop && ++cnt > lengthValue ) {
+              break;
+          }
+          viewableData.add( iterator.next() );
+      } 
+      
       return viewableData;
    }
 
@@ -942,6 +983,162 @@
    }
 
 
+    private void appendColumn (StringBuffer buf, int i, int rowcnt, ColumnDecorator[] 
colDecorators)  throws JspException{
+        ColumnTag tag = (ColumnTag)this.columns.get( i );
+
+        buf.append( "<td " );
+        buf.append( tag.getCellAttributes() );
+        buf.append( ">" );
+        
+        // Get the value to be displayed for the column
+        
+        Object value = null;
+        if( tag.getValue() != null ) {
+            value = tag.getValue();
+        } else {
+            if( tag.getProperty().equals( "ff" ) ) {
+                value = String.valueOf( rowcnt );
+            } else {
+                value =
+                    this.lookup( pageContext, "smartRow",
+                                 tag.getProperty(), null, true );
+                
+                // paulsenj:columndecorator
+                // if columndecorator supplied for this column
+                // call it to decorate the value
+                // ed - I call the column decorator after the table decorator is 
called
+                // feel free to modify this as you wish
+                if( colDecorators[i] != null )
+                    value = colDecorators[i].decorate( value );
+            }
+        }
+        
+        // By default, we show null values as empty strings, unless the
+        // user tells us otherwise.
+        
+        if( value == null || value.equals( "null" ) ) {
+            if( tag.getNulls() == null || tag.getNulls().equals( "false" ) ) {
+                value = "";
+            }
+        }
+        
+        // String to hold what's left over after value is chopped
+        String leftover = "";
+        boolean chopped = false;
+        String tempValue = "";
+        if( value != null ) {
+            tempValue = value.toString();
+        }
+        
+        // trim the string if a maxLength or maxWords is defined
+        if( tag.getMaxLength() > 0 && tempValue.length() > tag.getMaxLength() ) {
+            leftover = "..." + tempValue.substring( tag.getMaxLength(), 
tempValue.length() );
+            value = tempValue.substring( 0, tag.getMaxLength() ) + "...";
+            chopped = true;
+        } else if( tag.getMaxWords() > 0 ) {
+            StringBuffer tmpBuffer = new StringBuffer();
+            StringTokenizer st = new StringTokenizer( tempValue );
+            int numTokens = st.countTokens();
+            if( numTokens > tag.getMaxWords() ) {
+                int x = 0;
+                while( st.hasMoreTokens() && ( x < tag.getMaxWords() ) ) {
+                    tmpBuffer.append( st.nextToken() + " " );
+                    x++;
+                }
+                leftover = "..." + tempValue.substring( tmpBuffer.length(), 
tempValue.length() );
+                tmpBuffer.append( "..." );
+                value = tmpBuffer;
+                chopped = true;
+            }
+        }
+        
+        
+        // Are we supposed to set up a link to the data being displayed
+        // in this column...
+        
+        if( tag.getAutolink() != null && tag.getAutolink().equals( "true" ) ) {
+            // TODO, set up some regex style function that does a search
+            // and replace on email addresses, and URLs...  Don't use any
+            // 3rd party stuff...
+            
+            value = this.autoLink( value.toString() );
+        }
+        
+        // TODO - This args stuff is very bad, it really needs cleaned up..
+        
+        if( tag.getHref() != null ) {
+            if( tag.getParamId() != null ) {
+                String name = tag.getParamName();
+                
+                if( name == null ) {
+                    name = "smartRow";
+                }
+                
+                Object param =
+                    this.lookup( pageContext, name,
+                                 tag.getParamProperty(), tag.getParamScope(), true );
+                
+                // flag to determine if we should use a ? or a &
+                int index = tag.getHref().indexOf( '?' );
+                String separator = "";
+                if( index == -1 ) {
+                    separator = "?";
+                } else {
+                    separator = "&";
+                }
+                // if value has been chopped, add leftover as title
+                if( chopped ) {
+                    value = "<a href=\"" + tag.getHref() + separator + 
tag.getParamId() +
+                        "=" + param + "\" title=\"" + leftover + "\">" + value + 
"</a>";
+                } else {
+                    value = "<a href=\"" + tag.getHref() + separator + 
tag.getParamId() +
+                        "=" + param + "\">" + value + "</a>";
+                }
+            } else {
+                // if value has been chopped, add leftover as title
+                if( chopped ) {
+                    value = "<a href=\"" + tag.getHref() + "\" title=\"" + leftover + 
"\">" + value + "</a>";
+                } else {
+                    value = "<a href=\"" + tag.getHref() + "\">" + value + "</a>";
+                }
+            }
+        }
+        
+        // Ok, let's write this column's cell...
+        
+        /*
+          if( rowcnt % 2 == 0 ) {
+          buf.append( this.value );
+          } else {
+          buf.append( value );
+          }
+        */
+        
+        if( tag.getGroup() != null ) {
+            try {
+                //System.err.println ( "Tag getGroup : " + tag.getGroup() );
+                buf.append( this.groupColumns( value.toString(), new Integer( 
(String)tag.getGroup() ).intValue() ) );
+            } catch( Exception e ) {
+                System.err.println( e.getMessage() );
+                e.printStackTrace( System.err );
+            }
+        } else {
+            if( chopped && tag.getHref() == null ) {
+                
+                buf.append( value.toString().substring( 0, value.toString().length() 
- 3 ) );
+                buf.append( "<a style=\"cursor: help;\" title=\"" + leftover +
+                            "\">" );
+                buf.append( value.toString().substring( value.toString().length() - 3,
+                                                        value.toString().length() ) + 
"</a>" );
+            } else {
+                buf.append( value );
+            }
+            
+        }
+        
+        buf.append( "</td>\n" );
+    }
+
    private Hashtable previousRow = null;
    private Hashtable nextRow = null;
 
@@ -969,6 +1166,7 @@
       Iterator iterator = viewableData.iterator();
 
       while( iterator.hasNext() ) {
+
          Object obj = iterator.next();
 
          if( this.dec != null ) {
@@ -1007,161 +1205,7 @@
          // that we are currently focused on (lives in "smartRow").
 
          for( int i = 0; i < this.columns.size(); i++ ) {
-            ColumnTag tag = (ColumnTag)this.columns.get( i );
-
-            buf.append( "<td " );
-            buf.append( tag.getCellAttributes() );
-            buf.append( ">" );
-
-            // Get the value to be displayed for the column
-
-            Object value = null;
-            if( tag.getValue() != null ) {
-               value = tag.getValue();
-            } else {
-               if( tag.getProperty().equals( "ff" ) ) {
-                  value = String.valueOf( rowcnt );
-               } else {
-                  value =
-                     this.lookup( pageContext, "smartRow",
-                        tag.getProperty(), null, true );
-
-                  // paulsenj:columndecorator
-                  // if columndecorator supplied for this column
-                  // call it to decorate the value
-                  // ed - I call the column decorator after the table decorator is 
called
-                  // feel free to modify this as you wish
-                  if( colDecorators[i] != null )
-                     value = colDecorators[i].decorate( value );
-               }
-            }
-
-            // By default, we show null values as empty strings, unless the
-            // user tells us otherwise.
-
-            if( value == null || value.equals( "null" ) ) {
-               if( tag.getNulls() == null || tag.getNulls().equals( "false" ) ) {
-                  value = "";
-               }
-            }
-
-            // String to hold what's left over after value is chopped
-            String leftover = "";
-            boolean chopped = false;
-            String tempValue = "";
-            if( value != null ) {
-               tempValue = value.toString();
-            }
-
-            // trim the string if a maxLength or maxWords is defined
-            if( tag.getMaxLength() > 0 && tempValue.length() > tag.getMaxLength() ) {
-               leftover = "..." + tempValue.substring( tag.getMaxLength(), 
tempValue.length() );
-               value = tempValue.substring( 0, tag.getMaxLength() ) + "...";
-               chopped = true;
-            } else if( tag.getMaxWords() > 0 ) {
-               StringBuffer tmpBuffer = new StringBuffer();
-               StringTokenizer st = new StringTokenizer( tempValue );
-               int numTokens = st.countTokens();
-               if( numTokens > tag.getMaxWords() ) {
-                  int x = 0;
-                  while( st.hasMoreTokens() && ( x < tag.getMaxWords() ) ) {
-                     tmpBuffer.append( st.nextToken() + " " );
-                     x++;
-                  }
-                  leftover = "..." + tempValue.substring( tmpBuffer.length(), 
tempValue.length() );
-                  tmpBuffer.append( "..." );
-                  value = tmpBuffer;
-                  chopped = true;
-               }
-            }
-
-
-            // Are we supposed to set up a link to the data being displayed
-            // in this column...
-
-            if( tag.getAutolink() != null && tag.getAutolink().equals( "true" ) ) {
-               // TODO, set up some regex style function that does a search
-               // and replace on email addresses, and URLs...  Don't use any
-               // 3rd party stuff...
-
-               value = this.autoLink( value.toString() );
-            }
-
-
-            // TODO - This args stuff is very bad, it really needs cleaned up..
-
-            if( tag.getHref() != null ) {
-               if( tag.getParamId() != null ) {
-                  String name = tag.getParamName();
-
-                  if( name == null ) {
-                     name = "smartRow";
-                  }
-
-                  Object param =
-                     this.lookup( pageContext, name,
-                        tag.getParamProperty(), tag.getParamScope(), true );
-
-                  // flag to determine if we should use a ? or a &
-                  int index = tag.getHref().indexOf( '?' );
-                  String separator = "";
-                  if( index == -1 ) {
-                     separator = "?";
-                  } else {
-                     separator = "&";
-                  }
-                  // if value has been chopped, add leftover as title
-                  if( chopped ) {
-                     value = "<a href=\"" + tag.getHref() + separator + 
tag.getParamId() +
-                        "=" + param + "\" title=\"" + leftover + "\">" + value + 
"</a>";
-                  } else {
-                     value = "<a href=\"" + tag.getHref() + separator + 
tag.getParamId() +
-                        "=" + param + "\">" + value + "</a>";
-                  }
-               } else {
-                  // if value has been chopped, add leftover as title
-                  if( chopped ) {
-                     value = "<a href=\"" + tag.getHref() + "\" title=\"" + leftover 
+ "\">" + value + "</a>";
-                  } else {
-                     value = "<a href=\"" + tag.getHref() + "\">" + value + "</a>";
-                  }
-               }
-            }
-
-            // Ok, let's write this column's cell...
-
-
-            /*
-         if( rowcnt % 2 == 0 ) {
-               buf.append( this.value );
-            } else {
-               buf.append( value );
-            }
-         */
-
-            if( tag.getGroup() != null ) {
-               try {
-                  //System.err.println ( "Tag getGroup : " + tag.getGroup() );
-                  buf.append( this.groupColumns( value.toString(), new Integer( 
(String)tag.getGroup() ).intValue() ) );
-               } catch( Exception e ) {
-                  System.err.println( e.getMessage() );
-                  e.printStackTrace( System.err );
-               }
-            } else {
-               if( chopped && tag.getHref() == null ) {
-
-                  buf.append( value.toString().substring( 0, 
value.toString().length() - 3 ) );
-                  buf.append( "<a style=\"cursor: help;\" title=\"" + leftover +
-                     "\">" );
-                  buf.append( value.toString().substring( value.toString().length() - 
3,
-                     value.toString().length() ) + "</a>" );
-               } else {
-                  buf.append( value );
-               }
-
-            }
-
-            buf.append( "</td>\n" );
+             appendColumn (buf, i, rowcnt, colDecorators);
          }
 
          // Special case, if they didn't provide any columns, then just spit out
@@ -1185,7 +1229,6 @@
             if( colDecorators[c] != null )
                colDecorators[c].finishRow();
 
-
          rowcnt++;
       }
 
@@ -1496,7 +1539,7 @@
          buf.append( "</td>\n" );
          buf.append( "<td valign=\"bottom\" align=\"right\" class=\"" );
          buf.append( "tableCellAction\">\n" );
-         buf.append( helper.getPageNavigationBar( url + separator + "page={0}" ) );
+         buf.append( helper.getPageNavigationBar( url + separator + 
getPagingParamName () + "={0}" ) );
          buf.append( "</td>\n</tr></table></td></tr>\n" );
       }
 
@@ -1595,7 +1638,7 @@
             buf.append( "</td>\n" );
             buf.append( "<td valign=\"bottom\" align=\"right\" class=\"" );
             buf.append( "tableCellAction\">\n" );
-            buf.append( this.helper.getPageNavigationBar( url + separator + 
"page={0}" ) );
+            buf.append( this.helper.getPageNavigationBar( url + separator + 
getPagingParamName () + "={0}" ) );
             buf.append( "</td>\n</tr></table></td></tr>\n" );
          }
       }
@@ -1910,17 +1953,13 @@
          try {
             if( property == null ) return this.dec;
             return ( PropertyUtils.getProperty( this.dec, property ) );
-         } catch( IllegalAccessException e ) {
-            Object[] objs = {property, this.dec};
-            throw new JspException(
-               MessageFormat.format( prop.getProperty( 
"error.msg.illegal_access_exception" ), objs ) );
-         } catch( InvocationTargetException e ) {
-            Object[] objs = {property, this.dec};
-            throw new JspException(
-               MessageFormat.format( prop.getProperty( 
"error.msg.invocation_target_exception" ), objs ) );
          } catch( NoSuchMethodException e ) {
             // We ignore this puppy and just fall down to the bean lookup below.
-         }
+         } catch (Exception e) {
+             // For any other exception, we stack trace it, and return "";
+             e.printStackTrace ();
+             return "";
+         } 
       }
 
       // Look up the requested bean, and return if requested
@@ -1936,20 +1975,13 @@
       // Locate and return the specified property
 
       try {
-         return ( PropertyUtils.getProperty( bean, property ) );
-      } catch( IllegalAccessException e ) {
-         Object[] objs = {property, name};
-         throw new JspException(
-            MessageFormat.format( prop.getProperty( 
"error.msg.illegal_access_exception" ), objs ) );
-      } catch( InvocationTargetException e ) {
-         Object[] objs = {property, name};
-         throw new JspException(
-            MessageFormat.format( prop.getProperty( 
"error.msg.invocation_target_exception" ), objs ) );
-      } catch( NoSuchMethodException e ) {
-         Object[] objs = {property, name};
-         throw new JspException(
-            MessageFormat.format( prop.getProperty( 
"error.msg.nosuchmethod_exception" ), objs ) );
+          return ( PropertyUtils.getProperty( bean, property ) );
+      } catch( Exception e ) {
+          e.printStackTrace ();
+          Object[] objs = {property, name};
+          System.out.println (MessageFormat.format( prop.getProperty( 
"error.msg.invocation_target_exception" ), objs ).toString () );
       }
+      return "";
    }
 
 
@@ -2145,7 +2177,7 @@
       prop.setProperty( "paging.banner.one_item_found", "1 {0} found." );
       prop.setProperty( "paging.banner.all_items_found", "{0} {1} found, showing all 
{2}" );
       prop.setProperty( "paging.banner.some_items_found", "{0} {1} found, displaying 
{2} to {3}" );
-      prop.setProperty( "paging.banner.include_first_last", "false" );
+      prop.setProperty( "paging.banner.include_first_last", "true" );
       prop.setProperty( "paging.banner.first_label", "First" );
       prop.setProperty( "paging.banner.last_label", "Last" );
       prop.setProperty( "paging.banner.prev_label", "Prev" );
Index: xml/display.xml
===================================================================
RCS file: /cvsroot/displaytag/displaytag/xml/display.xml,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 display.xml
--- xml/display.xml     4 Feb 2003 01:35:43 -0000       1.1.1.1
+++ xml/display.xml     19 Mar 2003 23:54:08 -0000
@@ -157,6 +157,13 @@
                <availability>1.0</availability>
             </attribute>
             <attribute>
+               <name>cropCollection</name>
+               <required>false</required>
+               <rtexprvalue>true</rtexprvalue>
+               <description>Specify false if you don't want the tag tag to crop your 
collection based on offset/length or the page number/pagesize -- e.g. when you crop 
the collection yourself </description>
+               <availability>1.0</availability>
+            </attribute>
+            <attribute>
                <name>offset</name>
                <required>false</required>
                <rtexprvalue>true</rtexprvalue>
@@ -165,6 +172,13 @@
             </attribute>
             <attribute>
                <name>pagesize</name>
+               <required>false</required>
+               <rtexprvalue>true</rtexprvalue>
+               <description>...</description>
+               <availability>1.0</availability>
+            </attribute>
+            <attribute>
+               <name>pagingParamName</name>
                <required>false</required>
                <rtexprvalue>true</rtexprvalue>
                <description>...</description>

Reply via email to