You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2009/04/21 13:58:39 UTC

pagination in struts2

Are there any examples that show how to do pagination in struts2?

I would like to do pagination where we call the DB again when the user
clicks on one of the page numbers.

Re: pagination in struts2

Posted by Jim Kiley <jh...@summa-tech.com>.
Lots of possibilities here:* you need to have a class named TestList in your
application
* you need a constructor for your TestList class that accepts an int and a
boolean as its arguments
* you need to be sure you are appropriate importing the reference to
TestList in your JSP

On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:

> when i put
> <% request.setAttribute( "test", new TestList(2, false) ); %>
>
> netbeans said: cannot find construtcto TestList(int,bool)
>
> and the application goes in a exception:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP:
>
> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
> TestList cannot be resolved to a type
> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
> 3:
> 4:
>
> idea?
>
>
> 2009/4/23 André Diniz <ad...@gmail.com>:
> > It's just a sample pages...
> >
> > 2009/4/22 Dave Newton <ne...@yahoo.com>
> >
> >> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
> >>
> >> It pays to really spend some time looking over existing documentation;
> it's
> >> often quicker than waiting for someone on a list or forum to answer.
> >>
> >> Dave
> >>
> >>
> >> Bhaarat Sharma wrote:
> >>
> >>> jim,
> >>>
> >>> I found this example
> >>>
> >>>
> >>>
> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
> >>>
> >>> it says "Ok, you have made a query that returns you back a list of 120
> >>> elements, but you don't want to show the user all 120 items at once,
> you
> >>> want to allow them to page through the results (pretend 120 is really
> 1200
> >>> or 12000)."
> >>>
> >>> they are iterating through a long 12000 record list and then just
> putting
> >>> that into pages.  What I was looking for was something that would show
> 50
> >>> results of 12000 on first page then when NEXT is cliked, it against
> goes
> >>> to
> >>> DB to get next 50 records.
> >>>
> >>>
> >>>
> >>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
> >>> wrote:
> >>>
> >>>  I found this within thirty seconds of clicking Dave's link:
> >>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
> >>>>
> >>>> Note that the contents of this page are actually fairly freakin'
> horrible
> >>>> and should not be done on a grownup application.  But the instructions
> >>>> are
> >>>> right there and easy to find.
> >>>>
> >>>> jk
> >>>>
> >>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
> >>>> wrote:
> >>>>
> >>>>  I wanted to use it for the purpose so that when I click NEXT or 2nd
> page
> >>>>> then again I go to the DB to fetch next set of 50 records.
> >>>>>
> >>>>> but didnt see any examples of that sort
> >>>>>
> >>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
> >>>>> wrote:
> >>>>>
> >>>>>  Stefano Tranquillini wrote:
> >>>>>>
> >>>>>>  someone has experience with this tag?
> >>>>>>>
> >>>>>>> i don't really understand how it works.
> >>>>>>>
> >>>>>>>  What issues are you having? There are a number of tutorials and
> >>>>>>
> >>>>> examples
> >>>>
> >>>>> on
> >>>>>
> >>>>>> the site:
> >>>>>>
> >>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
> >>>>>>
> >>>>>> Dave
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>> --
> >>>> Jim Kiley
> >>>> Senior Technical Consultant | Summa
> >>>> [p] 412.258.3346
> >>>> http://www.summa-tech.com
> >>>>
> >>>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > André Diniz
> > +55 (41) 9997-5567
> > e-mail alternativo: dinizssa@msn.com
> >
>
>
>
> --
> Stefano
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Re: pagination in struts2

Posted by Stefano Tranquillini <st...@gmail.com>.
i take a fast look about your link

i can done the presentation of the data by myself ?
these libraries done only the pagination?

On Thu, Apr 23, 2009 at 23:08, denis cabasson <de...@gmail.com> wrote:
> Display tag is great for table pagination.
> If you are looking for pagination without tables, I'd recommend the pager
> tag library :
> http://jsptags.com/tags/navigation/pager/index.jsp
> Custom coding is my least favorite way of solving an issue.
> To extract a variable from an action to the page, I'd recommend using a
> s:set tag to set a variable holding the list in the page context.
> Your example of displaytag is missing :
> <s:set name="testList" scope="page" value="testList" id="testList"></s:set>
> (before the display tag)
>
> Denis.
>
> On Thu, Apr 23, 2009 at 1:01 PM, Stefano Tranquillini <
> stefano.tranquillini@gmail.com> wrote:
>
>> i've done a pagination by myself.
>> is an Alpha relase :D, not tested but u can set size and page to display:
>>
>> action:
>>
>>
>>    private List<Item> items = new ArrayList<Item>();
>>     private int tot;
>>    private int page = 0;
>>    private int size = 1;
>>    private List pages = new ArrayList();
>>
>>    public AllItem() {
>>    }
>>
>>    @Override
>>    public String execute() throws Exception {
>>           List<Item> temp = mgmt.getAllItem();
>>        if (page > 0) {
>>            page--;
>>        }
>>        if (size > temp.size()) {
>>            size = temp.size();
>>        }
>>        int start = Math.min(page * size, temp.size());
>>        if (start == temp.size()) {
>>            start = start - size;
>>        }
>>        int end = Math.min((page + 1) * size, temp.size());
>>        items = new ArrayList<Item>();
>>        items = temp.subList(start, end);
>>        tot = getItems().size();
>>        pages = new ArrayList();
>>        for (int i = 0; i < temp.size(); i = i + size) {
>>            pages.add((i / size) + 1);
>>         }
>>        return SUCCESS;
>>    }
>>
>>    public List<Item> getItems() {
>>        return items;
>>    }
>>
>>     public int getTot() {
>>        return tot;
>>    }
>>
>>    public int getPage() {
>>        return page;
>>    }
>>
>>    public void setPage(int page) {
>>        this.page = page;
>>    }
>>
>>    public int getSize() {
>>        return size;
>>    }
>>
>>    public void setSize(int size) {
>>        this.size = size;
>>    }
>>
>>    public List getPages() {
>>        return pages;
>>    }
>>
>> jsp
>>
>> <%@ taglib uri="/struts-tags" prefix="s" %>
>>
>>
>>     <s:iterator value="items" >
>>        do your presentation of the data
>>
>>    </s:iterator>
>>
>> this is the menu change the action!
>>    <s:iterator value="pages" >
>>        <a href="<s:url action="showShop" namespace="/shop">
>>               <s:param name="page">
>>                   <s:property/>
>>               </s:param>
>>               <s:param name="size" value="%{size}"/>
>>           </s:url>">
>>            <s:property/>
>>        </a>
>>    </s:iterator>
>>
>> On Thu, Apr 23, 2009 at 18:28, Andy Sykes <a....@ucl.ac.uk> wrote:
>> > I found I had to use the <s:set> tag to set the object in the request
>> scope
>> > before displaytag could "see" it, since displaytag doesn't know about the
>> > Value Stack (maybe it should?). Confusingly, displaytag gives you that
>> > message if it can't see the variable you're referencing, as well as if
>> the
>> > variable is empty.
>> >
>> > eg. <s:set name="items" value="items" scope="request"/>
>> >
>> > On 23 Apr 2009, at 17:11, Stefano Tranquillini wrote:
>> >
>> >> i done this:
>> >>
>> >> this is the class taht create the list
>> >>
>> >>   private List<Item> items = new ArrayList<Item>();
>> >>   private Integer resultSize;
>> >>
>> >>   public AllItem() {
>> >>   }
>> >>
>> >>   @Override
>> >>   public String execute() throws Exception {
>> >>      items= mgmt.getAllItem();
>> >>       resultSize=getItems().size();
>> >>       return SUCCESS;
>> >>   }
>> >>
>> >>   public List<Item> getItems() {
>> >>       return items;
>> >>   }
>> >>
>> >>
>> >>   public Integer getResultSize() {
>> >>       return resultSize;
>> >>   }
>> >>
>> >> this is the page
>> >>
>> >> <%@ taglib uri="/struts-tags" prefix="s" %>
>> >> <%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
>> >>
>> >> <display:table name="testList" pagesize="2" partialList="true"
>> >> size="resultSize">
>> >>   <display:column property="name" />
>> >>   <display:column property="descitipion" />
>> >>   <display:column property="prize"  />
>> >> </display:table>
>> >>
>> >> the result is:
>> >> Nothing found to display.
>> >>
>> >> On Thu, Apr 23, 2009 at 17:52, Stefano Tranquillini
>> >> <st...@gmail.com> wrote:
>> >>>
>> >>> emm i've a list in my session called items.
>> >>>
>> >>> so i'd write
>> >>> a ok, i'd understand, now works.
>> >>>
>> >>> anyway, how can i create the page number below?
>> >>>
>> >>>
>> >>> On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma <bh...@gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> u have to first create TestList for the code to work
>> >>>>
>> >>>> On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:
>> >>>>
>> >>>>> when i put
>> >>>>> <% request.setAttribute( "test", new TestList(2, false) ); %>
>> >>>>>
>> >>>>> netbeans said: cannot find construtcto TestList(int,bool)
>> >>>>>
>> >>>>> and the application goes in a exception:
>> >>>>>
>> >>>>> org.apache.jasper.JasperException: Unable to compile class for JSP:
>> >>>>>
>> >>>>> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
>> >>>>> TestList cannot be resolved to a type
>> >>>>> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
>> >>>>> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
>> >>>>> 3:
>> >>>>> 4:
>> >>>>>
>> >>>>> idea?
>> >>>>>
>> >>>>>
>> >>>>> 2009/4/23 André Diniz <ad...@gmail.com>:
>> >>>>>>
>> >>>>>> It's just a sample pages...
>> >>>>>>
>> >>>>>> 2009/4/22 Dave Newton <ne...@yahoo.com>
>> >>>>>>
>> >>>>>>> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
>> >>>>>>>
>> >>>>>>> It pays to really spend some time looking over existing
>> >>>>>>> documentation;
>> >>>>>
>> >>>>> it's
>> >>>>>>>
>> >>>>>>> often quicker than waiting for someone on a list or forum to
>> answer.
>> >>>>>>>
>> >>>>>>> Dave
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> Bhaarat Sharma wrote:
>> >>>>>>>
>> >>>>>>>> jim,
>> >>>>>>>>
>> >>>>>>>> I found this example
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>
>> >>>>>
>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>> >>>>>>>>
>> >>>>>>>> it says "Ok, you have made a query that returns you back a list of
>> >>>>>>>> 120
>> >>>>>>>> elements, but you don't want to show the user all 120 items at
>> once,
>> >>>>>
>> >>>>> you
>> >>>>>>>>
>> >>>>>>>> want to allow them to page through the results (pretend 120 is
>> >>>>>>>> really
>> >>>>>
>> >>>>> 1200
>> >>>>>>>>
>> >>>>>>>> or 12000)."
>> >>>>>>>>
>> >>>>>>>> they are iterating through a long 12000 record list and then just
>> >>>>>
>> >>>>> putting
>> >>>>>>>>
>> >>>>>>>> that into pages.  What I was looking for was something that would
>> >>>>>>>> show
>> >>>>>
>> >>>>> 50
>> >>>>>>>>
>> >>>>>>>> results of 12000 on first page then when NEXT is cliked, it
>> against
>> >>>>>
>> >>>>> goes
>> >>>>>>>>
>> >>>>>>>> to
>> >>>>>>>> DB to get next 50 records.
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <
>> jhkiley@summa-tech.com>
>> >>>>>>>> wrote:
>> >>>>>>>>
>> >>>>>>>>  I found this within thirty seconds of clicking Dave's link:
>> >>>>>>>>>
>> >>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>> >>>>>>>>>
>> >>>>>>>>> Note that the contents of this page are actually fairly freakin'
>> >>>>>
>> >>>>> horrible
>> >>>>>>>>>
>> >>>>>>>>> and should not be done on a grownup application.  But the
>> >>>>>>>>> instructions
>> >>>>>>>>> are
>> >>>>>>>>> right there and easy to find.
>> >>>>>>>>>
>> >>>>>>>>> jk
>> >>>>>>>>>
>> >>>>>>>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma
>> >>>>>>>>> <bh...@gmail.com>
>> >>>>>>>>> wrote:
>> >>>>>>>>>
>> >>>>>>>>>  I wanted to use it for the purpose so that when I click NEXT or
>> >>>>>>>>> 2nd
>> >>>>>
>> >>>>> page
>> >>>>>>>>>>
>> >>>>>>>>>> then again I go to the DB to fetch next set of 50 records.
>> >>>>>>>>>>
>> >>>>>>>>>> but didnt see any examples of that sort
>> >>>>>>>>>>
>> >>>>>>>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton
>> >>>>>>>>>> <ne...@yahoo.com>
>> >>>>>>>>>> wrote:
>> >>>>>>>>>>
>> >>>>>>>>>>  Stefano Tranquillini wrote:
>> >>>>>>>>>>>
>> >>>>>>>>>>>  someone has experience with this tag?
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> i don't really understand how it works.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>  What issues are you having? There are a number of tutorials
>> and
>> >>>>>>>>>>>
>> >>>>>>>>>> examples
>> >>>>>>>>>
>> >>>>>>>>>> on
>> >>>>>>>>>>
>> >>>>>>>>>>> the site:
>> >>>>>>>>>>>
>> >>>>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>> >>>>>>>>>>>
>> >>>>>>>>>>> Dave
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>> ---------------------------------------------------------------------
>> >>>>>>>>>>>
>> >>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> --
>> >>>>>>>>> Jim Kiley
>> >>>>>>>>> Senior Technical Consultant | Summa
>> >>>>>>>>> [p] 412.258.3346
>> >>>>>>>>> http://www.summa-tech.com
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>>
>> ---------------------------------------------------------------------
>> >>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>> >>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> --
>> >>>>>> André Diniz
>> >>>>>> +55 (41) 9997-5567
>> >>>>>> e-mail alternativo: dinizssa@msn.com
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> Stefano
>> >>>>>
>> >>>>> ---------------------------------------------------------------------
>> >>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >>>>> For additional commands, e-mail: user-help@struts.apache.org
>> >>>>>
>> >>>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Stefano
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Stefano
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>>
>>
>> --
>> Stefano
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by denis cabasson <de...@gmail.com>.
Display tag is great for table pagination.
If you are looking for pagination without tables, I'd recommend the pager
tag library :
http://jsptags.com/tags/navigation/pager/index.jsp
Custom coding is my least favorite way of solving an issue.
To extract a variable from an action to the page, I'd recommend using a
s:set tag to set a variable holding the list in the page context.
Your example of displaytag is missing :
<s:set name="testList" scope="page" value="testList" id="testList"></s:set>
(before the display tag)

Denis.

On Thu, Apr 23, 2009 at 1:01 PM, Stefano Tranquillini <
stefano.tranquillini@gmail.com> wrote:

> i've done a pagination by myself.
> is an Alpha relase :D, not tested but u can set size and page to display:
>
> action:
>
>
>    private List<Item> items = new ArrayList<Item>();
>     private int tot;
>    private int page = 0;
>    private int size = 1;
>    private List pages = new ArrayList();
>
>    public AllItem() {
>    }
>
>    @Override
>    public String execute() throws Exception {
>           List<Item> temp = mgmt.getAllItem();
>        if (page > 0) {
>            page--;
>        }
>        if (size > temp.size()) {
>            size = temp.size();
>        }
>        int start = Math.min(page * size, temp.size());
>        if (start == temp.size()) {
>            start = start - size;
>        }
>        int end = Math.min((page + 1) * size, temp.size());
>        items = new ArrayList<Item>();
>        items = temp.subList(start, end);
>        tot = getItems().size();
>        pages = new ArrayList();
>        for (int i = 0; i < temp.size(); i = i + size) {
>            pages.add((i / size) + 1);
>         }
>        return SUCCESS;
>    }
>
>    public List<Item> getItems() {
>        return items;
>    }
>
>     public int getTot() {
>        return tot;
>    }
>
>    public int getPage() {
>        return page;
>    }
>
>    public void setPage(int page) {
>        this.page = page;
>    }
>
>    public int getSize() {
>        return size;
>    }
>
>    public void setSize(int size) {
>        this.size = size;
>    }
>
>    public List getPages() {
>        return pages;
>    }
>
> jsp
>
> <%@ taglib uri="/struts-tags" prefix="s" %>
>
>
>     <s:iterator value="items" >
>        do your presentation of the data
>
>    </s:iterator>
>
> this is the menu change the action!
>    <s:iterator value="pages" >
>        <a href="<s:url action="showShop" namespace="/shop">
>               <s:param name="page">
>                   <s:property/>
>               </s:param>
>               <s:param name="size" value="%{size}"/>
>           </s:url>">
>            <s:property/>
>        </a>
>    </s:iterator>
>
> On Thu, Apr 23, 2009 at 18:28, Andy Sykes <a....@ucl.ac.uk> wrote:
> > I found I had to use the <s:set> tag to set the object in the request
> scope
> > before displaytag could "see" it, since displaytag doesn't know about the
> > Value Stack (maybe it should?). Confusingly, displaytag gives you that
> > message if it can't see the variable you're referencing, as well as if
> the
> > variable is empty.
> >
> > eg. <s:set name="items" value="items" scope="request"/>
> >
> > On 23 Apr 2009, at 17:11, Stefano Tranquillini wrote:
> >
> >> i done this:
> >>
> >> this is the class taht create the list
> >>
> >>   private List<Item> items = new ArrayList<Item>();
> >>   private Integer resultSize;
> >>
> >>   public AllItem() {
> >>   }
> >>
> >>   @Override
> >>   public String execute() throws Exception {
> >>      items= mgmt.getAllItem();
> >>       resultSize=getItems().size();
> >>       return SUCCESS;
> >>   }
> >>
> >>   public List<Item> getItems() {
> >>       return items;
> >>   }
> >>
> >>
> >>   public Integer getResultSize() {
> >>       return resultSize;
> >>   }
> >>
> >> this is the page
> >>
> >> <%@ taglib uri="/struts-tags" prefix="s" %>
> >> <%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
> >>
> >> <display:table name="testList" pagesize="2" partialList="true"
> >> size="resultSize">
> >>   <display:column property="name" />
> >>   <display:column property="descitipion" />
> >>   <display:column property="prize"  />
> >> </display:table>
> >>
> >> the result is:
> >> Nothing found to display.
> >>
> >> On Thu, Apr 23, 2009 at 17:52, Stefano Tranquillini
> >> <st...@gmail.com> wrote:
> >>>
> >>> emm i've a list in my session called items.
> >>>
> >>> so i'd write
> >>> a ok, i'd understand, now works.
> >>>
> >>> anyway, how can i create the page number below?
> >>>
> >>>
> >>> On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma <bh...@gmail.com>
> >>> wrote:
> >>>>
> >>>> u have to first create TestList for the code to work
> >>>>
> >>>> On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:
> >>>>
> >>>>> when i put
> >>>>> <% request.setAttribute( "test", new TestList(2, false) ); %>
> >>>>>
> >>>>> netbeans said: cannot find construtcto TestList(int,bool)
> >>>>>
> >>>>> and the application goes in a exception:
> >>>>>
> >>>>> org.apache.jasper.JasperException: Unable to compile class for JSP:
> >>>>>
> >>>>> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
> >>>>> TestList cannot be resolved to a type
> >>>>> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
> >>>>> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
> >>>>> 3:
> >>>>> 4:
> >>>>>
> >>>>> idea?
> >>>>>
> >>>>>
> >>>>> 2009/4/23 André Diniz <ad...@gmail.com>:
> >>>>>>
> >>>>>> It's just a sample pages...
> >>>>>>
> >>>>>> 2009/4/22 Dave Newton <ne...@yahoo.com>
> >>>>>>
> >>>>>>> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
> >>>>>>>
> >>>>>>> It pays to really spend some time looking over existing
> >>>>>>> documentation;
> >>>>>
> >>>>> it's
> >>>>>>>
> >>>>>>> often quicker than waiting for someone on a list or forum to
> answer.
> >>>>>>>
> >>>>>>> Dave
> >>>>>>>
> >>>>>>>
> >>>>>>> Bhaarat Sharma wrote:
> >>>>>>>
> >>>>>>>> jim,
> >>>>>>>>
> >>>>>>>> I found this example
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>
> >>>>>
> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
> >>>>>>>>
> >>>>>>>> it says "Ok, you have made a query that returns you back a list of
> >>>>>>>> 120
> >>>>>>>> elements, but you don't want to show the user all 120 items at
> once,
> >>>>>
> >>>>> you
> >>>>>>>>
> >>>>>>>> want to allow them to page through the results (pretend 120 is
> >>>>>>>> really
> >>>>>
> >>>>> 1200
> >>>>>>>>
> >>>>>>>> or 12000)."
> >>>>>>>>
> >>>>>>>> they are iterating through a long 12000 record list and then just
> >>>>>
> >>>>> putting
> >>>>>>>>
> >>>>>>>> that into pages.  What I was looking for was something that would
> >>>>>>>> show
> >>>>>
> >>>>> 50
> >>>>>>>>
> >>>>>>>> results of 12000 on first page then when NEXT is cliked, it
> against
> >>>>>
> >>>>> goes
> >>>>>>>>
> >>>>>>>> to
> >>>>>>>> DB to get next 50 records.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <
> jhkiley@summa-tech.com>
> >>>>>>>> wrote:
> >>>>>>>>
> >>>>>>>>  I found this within thirty seconds of clicking Dave's link:
> >>>>>>>>>
> >>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
> >>>>>>>>>
> >>>>>>>>> Note that the contents of this page are actually fairly freakin'
> >>>>>
> >>>>> horrible
> >>>>>>>>>
> >>>>>>>>> and should not be done on a grownup application.  But the
> >>>>>>>>> instructions
> >>>>>>>>> are
> >>>>>>>>> right there and easy to find.
> >>>>>>>>>
> >>>>>>>>> jk
> >>>>>>>>>
> >>>>>>>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma
> >>>>>>>>> <bh...@gmail.com>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>  I wanted to use it for the purpose so that when I click NEXT or
> >>>>>>>>> 2nd
> >>>>>
> >>>>> page
> >>>>>>>>>>
> >>>>>>>>>> then again I go to the DB to fetch next set of 50 records.
> >>>>>>>>>>
> >>>>>>>>>> but didnt see any examples of that sort
> >>>>>>>>>>
> >>>>>>>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton
> >>>>>>>>>> <ne...@yahoo.com>
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>  Stefano Tranquillini wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>  someone has experience with this tag?
> >>>>>>>>>>>>
> >>>>>>>>>>>> i don't really understand how it works.
> >>>>>>>>>>>>
> >>>>>>>>>>>>  What issues are you having? There are a number of tutorials
> and
> >>>>>>>>>>>
> >>>>>>>>>> examples
> >>>>>>>>>
> >>>>>>>>>> on
> >>>>>>>>>>
> >>>>>>>>>>> the site:
> >>>>>>>>>>>
> >>>>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
> >>>>>>>>>>>
> >>>>>>>>>>> Dave
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>>>>>>>>
> >>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> --
> >>>>>>>>> Jim Kiley
> >>>>>>>>> Senior Technical Consultant | Summa
> >>>>>>>>> [p] 412.258.3346
> >>>>>>>>> http://www.summa-tech.com
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>>>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> André Diniz
> >>>>>> +55 (41) 9997-5567
> >>>>>> e-mail alternativo: dinizssa@msn.com
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Stefano
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Stefano
> >>>
> >>
> >>
> >>
> >> --
> >> Stefano
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Stefano
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: pagination in struts2

Posted by Stefano Tranquillini <st...@gmail.com>.
i've done a pagination by myself.
is an Alpha relase :D, not tested but u can set size and page to display:

action:


    private List<Item> items = new ArrayList<Item>();
    private int tot;
    private int page = 0;
    private int size = 1;
    private List pages = new ArrayList();

    public AllItem() {
    }

    @Override
    public String execute() throws Exception {
          List<Item> temp = mgmt.getAllItem();
        if (page > 0) {
            page--;
        }
        if (size > temp.size()) {
            size = temp.size();
        }
        int start = Math.min(page * size, temp.size());
        if (start == temp.size()) {
            start = start - size;
        }
        int end = Math.min((page + 1) * size, temp.size());
        items = new ArrayList<Item>();
        items = temp.subList(start, end);
        tot = getItems().size();
        pages = new ArrayList();
        for (int i = 0; i < temp.size(); i = i + size) {
            pages.add((i / size) + 1);
        }
        return SUCCESS;
    }

    public List<Item> getItems() {
        return items;
    }

    public int getTot() {
        return tot;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public List getPages() {
        return pages;
    }

jsp

<%@ taglib uri="/struts-tags" prefix="s" %>


    <s:iterator value="items" >
        do your presentation of the data

    </s:iterator>

this is the menu change the action!
    <s:iterator value="pages" >
        <a href="<s:url action="showShop" namespace="/shop">
               <s:param name="page">
                   <s:property/>
               </s:param>
               <s:param name="size" value="%{size}"/>
           </s:url>">
            <s:property/>
        </a>
    </s:iterator>

On Thu, Apr 23, 2009 at 18:28, Andy Sykes <a....@ucl.ac.uk> wrote:
> I found I had to use the <s:set> tag to set the object in the request scope
> before displaytag could "see" it, since displaytag doesn't know about the
> Value Stack (maybe it should?). Confusingly, displaytag gives you that
> message if it can't see the variable you're referencing, as well as if the
> variable is empty.
>
> eg. <s:set name="items" value="items" scope="request"/>
>
> On 23 Apr 2009, at 17:11, Stefano Tranquillini wrote:
>
>> i done this:
>>
>> this is the class taht create the list
>>
>>   private List<Item> items = new ArrayList<Item>();
>>   private Integer resultSize;
>>
>>   public AllItem() {
>>   }
>>
>>   @Override
>>   public String execute() throws Exception {
>>      items= mgmt.getAllItem();
>>       resultSize=getItems().size();
>>       return SUCCESS;
>>   }
>>
>>   public List<Item> getItems() {
>>       return items;
>>   }
>>
>>
>>   public Integer getResultSize() {
>>       return resultSize;
>>   }
>>
>> this is the page
>>
>> <%@ taglib uri="/struts-tags" prefix="s" %>
>> <%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
>>
>> <display:table name="testList" pagesize="2" partialList="true"
>> size="resultSize">
>>   <display:column property="name" />
>>   <display:column property="descitipion" />
>>   <display:column property="prize"  />
>> </display:table>
>>
>> the result is:
>> Nothing found to display.
>>
>> On Thu, Apr 23, 2009 at 17:52, Stefano Tranquillini
>> <st...@gmail.com> wrote:
>>>
>>> emm i've a list in my session called items.
>>>
>>> so i'd write
>>> a ok, i'd understand, now works.
>>>
>>> anyway, how can i create the page number below?
>>>
>>>
>>> On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma <bh...@gmail.com>
>>> wrote:
>>>>
>>>> u have to first create TestList for the code to work
>>>>
>>>> On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:
>>>>
>>>>> when i put
>>>>> <% request.setAttribute( "test", new TestList(2, false) ); %>
>>>>>
>>>>> netbeans said: cannot find construtcto TestList(int,bool)
>>>>>
>>>>> and the application goes in a exception:
>>>>>
>>>>> org.apache.jasper.JasperException: Unable to compile class for JSP:
>>>>>
>>>>> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
>>>>> TestList cannot be resolved to a type
>>>>> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
>>>>> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
>>>>> 3:
>>>>> 4:
>>>>>
>>>>> idea?
>>>>>
>>>>>
>>>>> 2009/4/23 André Diniz <ad...@gmail.com>:
>>>>>>
>>>>>> It's just a sample pages...
>>>>>>
>>>>>> 2009/4/22 Dave Newton <ne...@yahoo.com>
>>>>>>
>>>>>>> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
>>>>>>>
>>>>>>> It pays to really spend some time looking over existing
>>>>>>> documentation;
>>>>>
>>>>> it's
>>>>>>>
>>>>>>> often quicker than waiting for someone on a list or forum to answer.
>>>>>>>
>>>>>>> Dave
>>>>>>>
>>>>>>>
>>>>>>> Bhaarat Sharma wrote:
>>>>>>>
>>>>>>>> jim,
>>>>>>>>
>>>>>>>> I found this example
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>
>>>>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>>>>>>>>
>>>>>>>> it says "Ok, you have made a query that returns you back a list of
>>>>>>>> 120
>>>>>>>> elements, but you don't want to show the user all 120 items at once,
>>>>>
>>>>> you
>>>>>>>>
>>>>>>>> want to allow them to page through the results (pretend 120 is
>>>>>>>> really
>>>>>
>>>>> 1200
>>>>>>>>
>>>>>>>> or 12000)."
>>>>>>>>
>>>>>>>> they are iterating through a long 12000 record list and then just
>>>>>
>>>>> putting
>>>>>>>>
>>>>>>>> that into pages.  What I was looking for was something that would
>>>>>>>> show
>>>>>
>>>>> 50
>>>>>>>>
>>>>>>>> results of 12000 on first page then when NEXT is cliked, it against
>>>>>
>>>>> goes
>>>>>>>>
>>>>>>>> to
>>>>>>>> DB to get next 50 records.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>  I found this within thirty seconds of clicking Dave's link:
>>>>>>>>>
>>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>>>>>>>>
>>>>>>>>> Note that the contents of this page are actually fairly freakin'
>>>>>
>>>>> horrible
>>>>>>>>>
>>>>>>>>> and should not be done on a grownup application.  But the
>>>>>>>>> instructions
>>>>>>>>> are
>>>>>>>>> right there and easy to find.
>>>>>>>>>
>>>>>>>>> jk
>>>>>>>>>
>>>>>>>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma
>>>>>>>>> <bh...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>  I wanted to use it for the purpose so that when I click NEXT or
>>>>>>>>> 2nd
>>>>>
>>>>> page
>>>>>>>>>>
>>>>>>>>>> then again I go to the DB to fetch next set of 50 records.
>>>>>>>>>>
>>>>>>>>>> but didnt see any examples of that sort
>>>>>>>>>>
>>>>>>>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton
>>>>>>>>>> <ne...@yahoo.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>  Stefano Tranquillini wrote:
>>>>>>>>>>>
>>>>>>>>>>>  someone has experience with this tag?
>>>>>>>>>>>>
>>>>>>>>>>>> i don't really understand how it works.
>>>>>>>>>>>>
>>>>>>>>>>>>  What issues are you having? There are a number of tutorials and
>>>>>>>>>>>
>>>>>>>>>> examples
>>>>>>>>>
>>>>>>>>>> on
>>>>>>>>>>
>>>>>>>>>>> the site:
>>>>>>>>>>>
>>>>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>>>>>>>>>>
>>>>>>>>>>> Dave
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Jim Kiley
>>>>>>>>> Senior Technical Consultant | Summa
>>>>>>>>> [p] 412.258.3346
>>>>>>>>> http://www.summa-tech.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> André Diniz
>>>>>> +55 (41) 9997-5567
>>>>>> e-mail alternativo: dinizssa@msn.com
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Stefano
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Stefano
>>>
>>
>>
>>
>> --
>> Stefano
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Andy Sykes <a....@ucl.ac.uk>.
I found I had to use the <s:set> tag to set the object in the request  
scope before displaytag could "see" it, since displaytag doesn't know  
about the Value Stack (maybe it should?). Confusingly, displaytag  
gives you that message if it can't see the variable you're  
referencing, as well as if the variable is empty.

eg. <s:set name="items" value="items" scope="request"/>

On 23 Apr 2009, at 17:11, Stefano Tranquillini wrote:

> i done this:
>
> this is the class taht create the list
>
>    private List<Item> items = new ArrayList<Item>();
>    private Integer resultSize;
>
>    public AllItem() {
>    }
>
>    @Override
>    public String execute() throws Exception {
>       items= mgmt.getAllItem();
>        resultSize=getItems().size();
>        return SUCCESS;
>    }
>
>    public List<Item> getItems() {
>        return items;
>    }
>
>
>    public Integer getResultSize() {
>        return resultSize;
>    }
>
> this is the page
>
> <%@ taglib uri="/struts-tags" prefix="s" %>
> <%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
>
> <display:table name="testList" pagesize="2" partialList="true"
> size="resultSize">
>    <display:column property="name" />
>    <display:column property="descitipion" />
>    <display:column property="prize"  />
> </display:table>
>
> the result is:
> Nothing found to display.
>
> On Thu, Apr 23, 2009 at 17:52, Stefano Tranquillini
> <st...@gmail.com> wrote:
>> emm i've a list in my session called items.
>>
>> so i'd write
>> a ok, i'd understand, now works.
>>
>> anyway, how can i create the page number below?
>>
>>
>> On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma <bh...@gmail.com>  
>> wrote:
>>> u have to first create TestList for the code to work
>>>
>>> On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com>  
>>> wrote:
>>>
>>>> when i put
>>>> <% request.setAttribute( "test", new TestList(2, false) ); %>
>>>>
>>>> netbeans said: cannot find construtcto TestList(int,bool)
>>>>
>>>> and the application goes in a exception:
>>>>
>>>> org.apache.jasper.JasperException: Unable to compile class for JSP:
>>>>
>>>> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
>>>> TestList cannot be resolved to a type
>>>> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
>>>> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
>>>> 3:
>>>> 4:
>>>>
>>>> idea?
>>>>
>>>>
>>>> 2009/4/23 André Diniz <ad...@gmail.com>:
>>>>> It's just a sample pages...
>>>>>
>>>>> 2009/4/22 Dave Newton <ne...@yahoo.com>
>>>>>
>>>>>> http://displaytag.sourceforge.net/1.2/ 
>>>>>> tut_externalSortAndPage.html
>>>>>>
>>>>>> It pays to really spend some time looking over existing  
>>>>>> documentation;
>>>> it's
>>>>>> often quicker than waiting for someone on a list or forum to  
>>>>>> answer.
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>> Bhaarat Sharma wrote:
>>>>>>
>>>>>>> jim,
>>>>>>>
>>>>>>> I found this example
>>>>>>>
>>>>>>>
>>>>>>>
>>>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>>>>>>>
>>>>>>> it says "Ok, you have made a query that returns you back a  
>>>>>>> list of 120
>>>>>>> elements, but you don't want to show the user all 120 items at  
>>>>>>> once,
>>>> you
>>>>>>> want to allow them to page through the results (pretend 120 is  
>>>>>>> really
>>>> 1200
>>>>>>> or 12000)."
>>>>>>>
>>>>>>> they are iterating through a long 12000 record list and then  
>>>>>>> just
>>>> putting
>>>>>>> that into pages.  What I was looking for was something that  
>>>>>>> would show
>>>> 50
>>>>>>> results of 12000 on first page then when NEXT is cliked, it  
>>>>>>> against
>>>> goes
>>>>>>> to
>>>>>>> DB to get next 50 records.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jhkiley@summa-tech.com 
>>>>>>> >
>>>>>>> wrote:
>>>>>>>
>>>>>>>  I found this within thirty seconds of clicking Dave's link:
>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>>>>>>>
>>>>>>>> Note that the contents of this page are actually fairly  
>>>>>>>> freakin'
>>>> horrible
>>>>>>>> and should not be done on a grownup application.  But the  
>>>>>>>> instructions
>>>>>>>> are
>>>>>>>> right there and easy to find.
>>>>>>>>
>>>>>>>> jk
>>>>>>>>
>>>>>>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bhaarat.s@gmail.com 
>>>>>>>> >
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>  I wanted to use it for the purpose so that when I click NEXT  
>>>>>>>> or 2nd
>>>> page
>>>>>>>>> then again I go to the DB to fetch next set of 50 records.
>>>>>>>>>
>>>>>>>>> but didnt see any examples of that sort
>>>>>>>>>
>>>>>>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <newton.dave@yahoo.com 
>>>>>>>>> >
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>  Stefano Tranquillini wrote:
>>>>>>>>>>
>>>>>>>>>>  someone has experience with this tag?
>>>>>>>>>>>
>>>>>>>>>>> i don't really understand how it works.
>>>>>>>>>>>
>>>>>>>>>>>  What issues are you having? There are a number of  
>>>>>>>>>>> tutorials and
>>>>>>>>>>
>>>>>>>>> examples
>>>>>>>>
>>>>>>>>> on
>>>>>>>>>
>>>>>>>>>> the site:
>>>>>>>>>>
>>>>>>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>>>>>>>>>
>>>>>>>>>> Dave
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Jim Kiley
>>>>>>>> Senior Technical Consultant | Summa
>>>>>>>> [p] 412.258.3346
>>>>>>>> http://www.summa-tech.com
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> André Diniz
>>>>> +55 (41) 9997-5567
>>>>> e-mail alternativo: dinizssa@msn.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Stefano
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Stefano
>>
>
>
>
> -- 
> Stefano
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Stefano Tranquillini <st...@gmail.com>.
i done this:

this is the class taht create the list

    private List<Item> items = new ArrayList<Item>();
    private Integer resultSize;

    public AllItem() {
    }

    @Override
    public String execute() throws Exception {
       items= mgmt.getAllItem();
        resultSize=getItems().size();
        return SUCCESS;
    }

    public List<Item> getItems() {
        return items;
    }


    public Integer getResultSize() {
        return resultSize;
    }

this is the page

<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

<display:table name="testList" pagesize="2" partialList="true"
size="resultSize">
    <display:column property="name" />
    <display:column property="descitipion" />
    <display:column property="prize"  />
 </display:table>

the result is:
Nothing found to display.

On Thu, Apr 23, 2009 at 17:52, Stefano Tranquillini
<st...@gmail.com> wrote:
> emm i've a list in my session called items.
>
> so i'd write
> a ok, i'd understand, now works.
>
> anyway, how can i create the page number below?
>
>
> On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma <bh...@gmail.com> wrote:
>> u have to first create TestList for the code to work
>>
>> On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:
>>
>>> when i put
>>> <% request.setAttribute( "test", new TestList(2, false) ); %>
>>>
>>> netbeans said: cannot find construtcto TestList(int,bool)
>>>
>>> and the application goes in a exception:
>>>
>>> org.apache.jasper.JasperException: Unable to compile class for JSP:
>>>
>>> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
>>> TestList cannot be resolved to a type
>>> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
>>> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
>>> 3:
>>> 4:
>>>
>>> idea?
>>>
>>>
>>> 2009/4/23 André Diniz <ad...@gmail.com>:
>>> > It's just a sample pages...
>>> >
>>> > 2009/4/22 Dave Newton <ne...@yahoo.com>
>>> >
>>> >> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
>>> >>
>>> >> It pays to really spend some time looking over existing documentation;
>>> it's
>>> >> often quicker than waiting for someone on a list or forum to answer.
>>> >>
>>> >> Dave
>>> >>
>>> >>
>>> >> Bhaarat Sharma wrote:
>>> >>
>>> >>> jim,
>>> >>>
>>> >>> I found this example
>>> >>>
>>> >>>
>>> >>>
>>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>>> >>>
>>> >>> it says "Ok, you have made a query that returns you back a list of 120
>>> >>> elements, but you don't want to show the user all 120 items at once,
>>> you
>>> >>> want to allow them to page through the results (pretend 120 is really
>>> 1200
>>> >>> or 12000)."
>>> >>>
>>> >>> they are iterating through a long 12000 record list and then just
>>> putting
>>> >>> that into pages.  What I was looking for was something that would show
>>> 50
>>> >>> results of 12000 on first page then when NEXT is cliked, it against
>>> goes
>>> >>> to
>>> >>> DB to get next 50 records.
>>> >>>
>>> >>>
>>> >>>
>>> >>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
>>> >>> wrote:
>>> >>>
>>> >>>  I found this within thirty seconds of clicking Dave's link:
>>> >>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>> >>>>
>>> >>>> Note that the contents of this page are actually fairly freakin'
>>> horrible
>>> >>>> and should not be done on a grownup application.  But the instructions
>>> >>>> are
>>> >>>> right there and easy to find.
>>> >>>>
>>> >>>> jk
>>> >>>>
>>> >>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
>>> >>>> wrote:
>>> >>>>
>>> >>>>  I wanted to use it for the purpose so that when I click NEXT or 2nd
>>> page
>>> >>>>> then again I go to the DB to fetch next set of 50 records.
>>> >>>>>
>>> >>>>> but didnt see any examples of that sort
>>> >>>>>
>>> >>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
>>> >>>>> wrote:
>>> >>>>>
>>> >>>>>  Stefano Tranquillini wrote:
>>> >>>>>>
>>> >>>>>>  someone has experience with this tag?
>>> >>>>>>>
>>> >>>>>>> i don't really understand how it works.
>>> >>>>>>>
>>> >>>>>>>  What issues are you having? There are a number of tutorials and
>>> >>>>>>
>>> >>>>> examples
>>> >>>>
>>> >>>>> on
>>> >>>>>
>>> >>>>>> the site:
>>> >>>>>>
>>> >>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>> >>>>>>
>>> >>>>>> Dave
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>
>>> ---------------------------------------------------------------------
>>> >>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> >>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>
>>> >>>> --
>>> >>>> Jim Kiley
>>> >>>> Senior Technical Consultant | Summa
>>> >>>> [p] 412.258.3346
>>> >>>> http://www.summa-tech.com
>>> >>>>
>>> >>>>
>>> >>>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> >> For additional commands, e-mail: user-help@struts.apache.org
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > André Diniz
>>> > +55 (41) 9997-5567
>>> > e-mail alternativo: dinizssa@msn.com
>>> >
>>>
>>>
>>>
>>> --
>>> Stefano
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
>
>
> --
> Stefano
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Stefano Tranquillini <st...@gmail.com>.
emm i've a list in my session called items.

so i'd write
a ok, i'd understand, now works.

anyway, how can i create the page number below?


On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma <bh...@gmail.com> wrote:
> u have to first create TestList for the code to work
>
> On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:
>
>> when i put
>> <% request.setAttribute( "test", new TestList(2, false) ); %>
>>
>> netbeans said: cannot find construtcto TestList(int,bool)
>>
>> and the application goes in a exception:
>>
>> org.apache.jasper.JasperException: Unable to compile class for JSP:
>>
>> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
>> TestList cannot be resolved to a type
>> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
>> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
>> 3:
>> 4:
>>
>> idea?
>>
>>
>> 2009/4/23 André Diniz <ad...@gmail.com>:
>> > It's just a sample pages...
>> >
>> > 2009/4/22 Dave Newton <ne...@yahoo.com>
>> >
>> >> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
>> >>
>> >> It pays to really spend some time looking over existing documentation;
>> it's
>> >> often quicker than waiting for someone on a list or forum to answer.
>> >>
>> >> Dave
>> >>
>> >>
>> >> Bhaarat Sharma wrote:
>> >>
>> >>> jim,
>> >>>
>> >>> I found this example
>> >>>
>> >>>
>> >>>
>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>> >>>
>> >>> it says "Ok, you have made a query that returns you back a list of 120
>> >>> elements, but you don't want to show the user all 120 items at once,
>> you
>> >>> want to allow them to page through the results (pretend 120 is really
>> 1200
>> >>> or 12000)."
>> >>>
>> >>> they are iterating through a long 12000 record list and then just
>> putting
>> >>> that into pages.  What I was looking for was something that would show
>> 50
>> >>> results of 12000 on first page then when NEXT is cliked, it against
>> goes
>> >>> to
>> >>> DB to get next 50 records.
>> >>>
>> >>>
>> >>>
>> >>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
>> >>> wrote:
>> >>>
>> >>>  I found this within thirty seconds of clicking Dave's link:
>> >>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>> >>>>
>> >>>> Note that the contents of this page are actually fairly freakin'
>> horrible
>> >>>> and should not be done on a grownup application.  But the instructions
>> >>>> are
>> >>>> right there and easy to find.
>> >>>>
>> >>>> jk
>> >>>>
>> >>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
>> >>>> wrote:
>> >>>>
>> >>>>  I wanted to use it for the purpose so that when I click NEXT or 2nd
>> page
>> >>>>> then again I go to the DB to fetch next set of 50 records.
>> >>>>>
>> >>>>> but didnt see any examples of that sort
>> >>>>>
>> >>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
>> >>>>> wrote:
>> >>>>>
>> >>>>>  Stefano Tranquillini wrote:
>> >>>>>>
>> >>>>>>  someone has experience with this tag?
>> >>>>>>>
>> >>>>>>> i don't really understand how it works.
>> >>>>>>>
>> >>>>>>>  What issues are you having? There are a number of tutorials and
>> >>>>>>
>> >>>>> examples
>> >>>>
>> >>>>> on
>> >>>>>
>> >>>>>> the site:
>> >>>>>>
>> >>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>> >>>>>>
>> >>>>>> Dave
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >>>>>> For additional commands, e-mail: user-help@struts.apache.org
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>
>> >>>> --
>> >>>> Jim Kiley
>> >>>> Senior Technical Consultant | Summa
>> >>>> [p] 412.258.3346
>> >>>> http://www.summa-tech.com
>> >>>>
>> >>>>
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > André Diniz
>> > +55 (41) 9997-5567
>> > e-mail alternativo: dinizssa@msn.com
>> >
>>
>>
>>
>> --
>> Stefano
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Bhaarat Sharma <bh...@gmail.com>.
u have to first create TestList for the code to work

On Thu, Apr 23, 2009 at 11:36 AM, Stefano <el...@gmail.com> wrote:

> when i put
> <% request.setAttribute( "test", new TestList(2, false) ); %>
>
> netbeans said: cannot find construtcto TestList(int,bool)
>
> and the application goes in a exception:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP:
>
> An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
> TestList cannot be resolved to a type
> 1: <% request.setAttribute( "test", new TestList(2, false) ); %>
> 2: <%@ taglib uri="/struts-tags" prefix="s" %>
> 3:
> 4:
>
> idea?
>
>
> 2009/4/23 André Diniz <ad...@gmail.com>:
> > It's just a sample pages...
> >
> > 2009/4/22 Dave Newton <ne...@yahoo.com>
> >
> >> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
> >>
> >> It pays to really spend some time looking over existing documentation;
> it's
> >> often quicker than waiting for someone on a list or forum to answer.
> >>
> >> Dave
> >>
> >>
> >> Bhaarat Sharma wrote:
> >>
> >>> jim,
> >>>
> >>> I found this example
> >>>
> >>>
> >>>
> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
> >>>
> >>> it says "Ok, you have made a query that returns you back a list of 120
> >>> elements, but you don't want to show the user all 120 items at once,
> you
> >>> want to allow them to page through the results (pretend 120 is really
> 1200
> >>> or 12000)."
> >>>
> >>> they are iterating through a long 12000 record list and then just
> putting
> >>> that into pages.  What I was looking for was something that would show
> 50
> >>> results of 12000 on first page then when NEXT is cliked, it against
> goes
> >>> to
> >>> DB to get next 50 records.
> >>>
> >>>
> >>>
> >>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
> >>> wrote:
> >>>
> >>>  I found this within thirty seconds of clicking Dave's link:
> >>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
> >>>>
> >>>> Note that the contents of this page are actually fairly freakin'
> horrible
> >>>> and should not be done on a grownup application.  But the instructions
> >>>> are
> >>>> right there and easy to find.
> >>>>
> >>>> jk
> >>>>
> >>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
> >>>> wrote:
> >>>>
> >>>>  I wanted to use it for the purpose so that when I click NEXT or 2nd
> page
> >>>>> then again I go to the DB to fetch next set of 50 records.
> >>>>>
> >>>>> but didnt see any examples of that sort
> >>>>>
> >>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
> >>>>> wrote:
> >>>>>
> >>>>>  Stefano Tranquillini wrote:
> >>>>>>
> >>>>>>  someone has experience with this tag?
> >>>>>>>
> >>>>>>> i don't really understand how it works.
> >>>>>>>
> >>>>>>>  What issues are you having? There are a number of tutorials and
> >>>>>>
> >>>>> examples
> >>>>
> >>>>> on
> >>>>>
> >>>>>> the site:
> >>>>>>
> >>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
> >>>>>>
> >>>>>> Dave
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>> --
> >>>> Jim Kiley
> >>>> Senior Technical Consultant | Summa
> >>>> [p] 412.258.3346
> >>>> http://www.summa-tech.com
> >>>>
> >>>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > André Diniz
> > +55 (41) 9997-5567
> > e-mail alternativo: dinizssa@msn.com
> >
>
>
>
> --
> Stefano
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: pagination in struts2

Posted by Stefano <el...@gmail.com>.
when i put
<% request.setAttribute( "test", new TestList(2, false) ); %>

netbeans said: cannot find construtcto TestList(int,bool)

and the application goes in a exception:

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp
TestList cannot be resolved to a type
1: <% request.setAttribute( "test", new TestList(2, false) ); %>
2: <%@ taglib uri="/struts-tags" prefix="s" %>
3:
4:

idea?


2009/4/23 André Diniz <ad...@gmail.com>:
> It's just a sample pages...
>
> 2009/4/22 Dave Newton <ne...@yahoo.com>
>
>> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
>>
>> It pays to really spend some time looking over existing documentation; it's
>> often quicker than waiting for someone on a list or forum to answer.
>>
>> Dave
>>
>>
>> Bhaarat Sharma wrote:
>>
>>> jim,
>>>
>>> I found this example
>>>
>>>
>>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>>>
>>> it says "Ok, you have made a query that returns you back a list of 120
>>> elements, but you don't want to show the user all 120 items at once, you
>>> want to allow them to page through the results (pretend 120 is really 1200
>>> or 12000)."
>>>
>>> they are iterating through a long 12000 record list and then just putting
>>> that into pages.  What I was looking for was something that would show 50
>>> results of 12000 on first page then when NEXT is cliked, it against goes
>>> to
>>> DB to get next 50 records.
>>>
>>>
>>>
>>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
>>> wrote:
>>>
>>>  I found this within thirty seconds of clicking Dave's link:
>>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>>>
>>>> Note that the contents of this page are actually fairly freakin' horrible
>>>> and should not be done on a grownup application.  But the instructions
>>>> are
>>>> right there and easy to find.
>>>>
>>>> jk
>>>>
>>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
>>>> wrote:
>>>>
>>>>  I wanted to use it for the purpose so that when I click NEXT or 2nd page
>>>>> then again I go to the DB to fetch next set of 50 records.
>>>>>
>>>>> but didnt see any examples of that sort
>>>>>
>>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
>>>>> wrote:
>>>>>
>>>>>  Stefano Tranquillini wrote:
>>>>>>
>>>>>>  someone has experience with this tag?
>>>>>>>
>>>>>>> i don't really understand how it works.
>>>>>>>
>>>>>>>  What issues are you having? There are a number of tutorials and
>>>>>>
>>>>> examples
>>>>
>>>>> on
>>>>>
>>>>>> the site:
>>>>>>
>>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> Jim Kiley
>>>> Senior Technical Consultant | Summa
>>>> [p] 412.258.3346
>>>> http://www.summa-tech.com
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> --
> André Diniz
> +55 (41) 9997-5567
> e-mail alternativo: dinizssa@msn.com
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by André Diniz <ad...@gmail.com>.
It's just a sample pages...

2009/4/22 Dave Newton <ne...@yahoo.com>

> http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
>
> It pays to really spend some time looking over existing documentation; it's
> often quicker than waiting for someone on a list or forum to answer.
>
> Dave
>
>
> Bhaarat Sharma wrote:
>
>> jim,
>>
>> I found this example
>>
>>
>> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>>
>> it says "Ok, you have made a query that returns you back a list of 120
>> elements, but you don't want to show the user all 120 items at once, you
>> want to allow them to page through the results (pretend 120 is really 1200
>> or 12000)."
>>
>> they are iterating through a long 12000 record list and then just putting
>> that into pages.  What I was looking for was something that would show 50
>> results of 12000 on first page then when NEXT is cliked, it against goes
>> to
>> DB to get next 50 records.
>>
>>
>>
>> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>
>> wrote:
>>
>>  I found this within thirty seconds of clicking Dave's link:
>>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>>
>>> Note that the contents of this page are actually fairly freakin' horrible
>>> and should not be done on a grownup application.  But the instructions
>>> are
>>> right there and easy to find.
>>>
>>> jk
>>>
>>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
>>> wrote:
>>>
>>>  I wanted to use it for the purpose so that when I click NEXT or 2nd page
>>>> then again I go to the DB to fetch next set of 50 records.
>>>>
>>>> but didnt see any examples of that sort
>>>>
>>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
>>>> wrote:
>>>>
>>>>  Stefano Tranquillini wrote:
>>>>>
>>>>>  someone has experience with this tag?
>>>>>>
>>>>>> i don't really understand how it works.
>>>>>>
>>>>>>  What issues are you having? There are a number of tutorials and
>>>>>
>>>> examples
>>>
>>>> on
>>>>
>>>>> the site:
>>>>>
>>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>>>>
>>>>> Dave
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>
>>> --
>>> Jim Kiley
>>> Senior Technical Consultant | Summa
>>> [p] 412.258.3346
>>> http://www.summa-tech.com
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
André Diniz
+55 (41) 9997-5567
e-mail alternativo: dinizssa@msn.com

Re: pagination in struts2

Posted by Dave Newton <ne...@yahoo.com>.
http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html

It pays to really spend some time looking over existing documentation; 
it's often quicker than waiting for someone on a list or forum to answer.

Dave

Bhaarat Sharma wrote:
> jim,
> 
> I found this example
> 
> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
> 
> it says "Ok, you have made a query that returns you back a list of 120
> elements, but you don't want to show the user all 120 items at once, you
> want to allow them to page through the results (pretend 120 is really 1200
> or 12000)."
> 
> they are iterating through a long 12000 record list and then just putting
> that into pages.  What I was looking for was something that would show 50
> results of 12000 on first page then when NEXT is cliked, it against goes to
> DB to get next 50 records.
> 
> 
> 
> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com> wrote:
> 
>> I found this within thirty seconds of clicking Dave's link:
>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>
>> Note that the contents of this page are actually fairly freakin' horrible
>> and should not be done on a grownup application.  But the instructions are
>> right there and easy to find.
>>
>> jk
>>
>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
>> wrote:
>>
>>> I wanted to use it for the purpose so that when I click NEXT or 2nd page
>>> then again I go to the DB to fetch next set of 50 records.
>>>
>>> but didnt see any examples of that sort
>>>
>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
>>> wrote:
>>>
>>>> Stefano Tranquillini wrote:
>>>>
>>>>> someone has experience with this tag?
>>>>>
>>>>> i don't really understand how it works.
>>>>>
>>>> What issues are you having? There are a number of tutorials and
>> examples
>>> on
>>>> the site:
>>>>
>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>>>
>>>> Dave
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>
>>
>> --
>> Jim Kiley
>> Senior Technical Consultant | Summa
>> [p] 412.258.3346
>> http://www.summa-tech.com
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Andy Sykes <a....@ucl.ac.uk>.
Have a look at the external sorting and pagination page[1] on the  
DisplayTag site. Also, take a look at the PaginatedList interface[2].

It takes a little bit to get your head around it.

If you get stuck, the displaytag lists are pretty good at helping with  
the common issues.

Andy.


[1] http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html
[2] http://displaytag.sourceforge.net/1.2/displaytag/apidocs/org/displaytag/pagination/PaginatedList.html

On 22 Apr 2009, at 22:27, Bhaarat Sharma wrote:

> jim,
>
> I found this example
>
> http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1
>
> it says "Ok, you have made a query that returns you back a list of 120
> elements, but you don't want to show the user all 120 items at once,  
> you
> want to allow them to page through the results (pretend 120 is  
> really 1200
> or 12000)."
>
> they are iterating through a long 12000 record list and then just  
> putting
> that into pages.  What I was looking for was something that would  
> show 50
> results of 12000 on first page then when NEXT is cliked, it against  
> goes to
> DB to get next 50 records.
>
>
>
> On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com>  
> wrote:
>
>> I found this within thirty seconds of clicking Dave's link:
>> http://displaytag.sourceforge.net/1.2/tut_sources.html
>>
>> Note that the contents of this page are actually fairly freakin'  
>> horrible
>> and should not be done on a grownup application.  But the  
>> instructions are
>> right there and easy to find.
>>
>> jk
>>
>> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
>> wrote:
>>
>>> I wanted to use it for the purpose so that when I click NEXT or  
>>> 2nd page
>>> then again I go to the DB to fetch next set of 50 records.
>>>
>>> but didnt see any examples of that sort
>>>
>>> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
>>> wrote:
>>>
>>>> Stefano Tranquillini wrote:
>>>>
>>>>> someone has experience with this tag?
>>>>>
>>>>> i don't really understand how it works.
>>>>>
>>>>
>>>> What issues are you having? There are a number of tutorials and
>> examples
>>> on
>>>> the site:
>>>>
>>>> http://displaytag.sourceforge.net/1.2/tut_basic.html
>>>>
>>>> Dave
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Jim Kiley
>> Senior Technical Consultant | Summa
>> [p] 412.258.3346
>> http://www.summa-tech.com
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Bhaarat Sharma <bh...@gmail.com>.
jim,

I found this example

http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1

it says "Ok, you have made a query that returns you back a list of 120
elements, but you don't want to show the user all 120 items at once, you
want to allow them to page through the results (pretend 120 is really 1200
or 12000)."

they are iterating through a long 12000 record list and then just putting
that into pages.  What I was looking for was something that would show 50
results of 12000 on first page then when NEXT is cliked, it against goes to
DB to get next 50 records.



On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley <jh...@summa-tech.com> wrote:

> I found this within thirty seconds of clicking Dave's link:
> http://displaytag.sourceforge.net/1.2/tut_sources.html
>
> Note that the contents of this page are actually fairly freakin' horrible
> and should not be done on a grownup application.  But the instructions are
> right there and easy to find.
>
> jk
>
> On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com>
> wrote:
>
> > I wanted to use it for the purpose so that when I click NEXT or 2nd page
> > then again I go to the DB to fetch next set of 50 records.
> >
> > but didnt see any examples of that sort
> >
> > On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
> > wrote:
> >
> > > Stefano Tranquillini wrote:
> > >
> > >> someone has experience with this tag?
> > >>
> > >> i don't really understand how it works.
> > >>
> > >
> > > What issues are you having? There are a number of tutorials and
> examples
> > on
> > > the site:
> > >
> > > http://displaytag.sourceforge.net/1.2/tut_basic.html
> > >
> > > Dave
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
>
>
>
> --
> Jim Kiley
> Senior Technical Consultant | Summa
> [p] 412.258.3346
> http://www.summa-tech.com
>

Re: pagination in struts2

Posted by Jim Kiley <jh...@summa-tech.com>.
I found this within thirty seconds of clicking Dave's link:
http://displaytag.sourceforge.net/1.2/tut_sources.html

Note that the contents of this page are actually fairly freakin' horrible
and should not be done on a grownup application.  But the instructions are
right there and easy to find.

jk

On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma <bh...@gmail.com> wrote:

> I wanted to use it for the purpose so that when I click NEXT or 2nd page
> then again I go to the DB to fetch next set of 50 records.
>
> but didnt see any examples of that sort
>
> On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com>
> wrote:
>
> > Stefano Tranquillini wrote:
> >
> >> someone has experience with this tag?
> >>
> >> i don't really understand how it works.
> >>
> >
> > What issues are you having? There are a number of tutorials and examples
> on
> > the site:
> >
> > http://displaytag.sourceforge.net/1.2/tut_basic.html
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>



-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Re: pagination in struts2

Posted by Bhaarat Sharma <bh...@gmail.com>.
I wanted to use it for the purpose so that when I click NEXT or 2nd page
then again I go to the DB to fetch next set of 50 records.

but didnt see any examples of that sort

On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton <ne...@yahoo.com> wrote:

> Stefano Tranquillini wrote:
>
>> someone has experience with this tag?
>>
>> i don't really understand how it works.
>>
>
> What issues are you having? There are a number of tutorials and examples on
> the site:
>
> http://displaytag.sourceforge.net/1.2/tut_basic.html
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: pagination in struts2

Posted by Dave Newton <ne...@yahoo.com>.
Stefano Tranquillini wrote:
> someone has experience with this tag?
> 
> i don't really understand how it works.

What issues are you having? There are a number of tutorials and examples 
on the site:

http://displaytag.sourceforge.net/1.2/tut_basic.html

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pagination in struts2

Posted by Stefano Tranquillini <st...@gmail.com>.
someone has experience with this tag?

i don't really understand how it works.

On Tue, Apr 21, 2009 at 18:39, Chris Pratt <th...@gmail.com> wrote:

> I'd suggest looking into DisplayTag (http://displaytag.sourceforge.net/)
>   (*Chris*)
>
> On Tue, Apr 21, 2009 at 4:58 AM, Bhaarat Sharma <bh...@gmail.com>
> wrote:
>
> > Are there any examples that show how to do pagination in struts2?
> >
> > I would like to do pagination where we call the DB again when the user
> > clicks on one of the page numbers.
> >
>



-- 
Stefano

Re: pagination in struts2

Posted by Chris Pratt <th...@gmail.com>.
I'd suggest looking into DisplayTag (http://displaytag.sourceforge.net/)
  (*Chris*)

On Tue, Apr 21, 2009 at 4:58 AM, Bhaarat Sharma <bh...@gmail.com> wrote:

> Are there any examples that show how to do pagination in struts2?
>
> I would like to do pagination where we call the DB again when the user
> clicks on one of the page numbers.
>