This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes TotalWrapper for displaytag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "TotalWrapper for displaytag" Watch "TotalWrapper for displaytag" New topic

TotalWrapper for displaytag

Grishma Dube
Ranch Hand

Joined: Jul 01, 2003
Posts: 275

I am using displaytag to display a table on the page. I have got a JSP which displays statistics table. At the end of the table, it shows total of each column.

To achieve this, i need to write a TotalWrapper using TableDecorator. Has anyone done this before? If yes, can anyone send me a sample?


Rajan Janakra

Joined: Jun 21, 2005
Posts: 9
Hi ,
In your jsp refer the decorator has shown below , <display:table decorator="com.sp.test.displaytag.TotalWrapper"
To write a decorator follow this steps,
1.import org.displaytag.decorator.TableDecorator;
2.Extend TableDecorator class
Give additional decoration or calculation with the getter method for the corresponding property name
//For Example
public String getNdccnt()
VO object = (VO) getCurrentRowObject();
int index = getListIndex();
int viewIndex=getViewIndex();
//your stuff object.methodname returns other bean properties.
return //decorated stuff;
Hope this would be helpfull
Grishma Dube
Ranch Hand

Joined: Jul 01, 2003
Posts: 275

I tried writting one wrapper...but facing some issues...

cud you pls elaborate?
Rajan Janakra

Joined: Jun 21, 2005
Posts: 9
Can you give me some detail on your issues?.
I agree. Here's the link:
subject: TotalWrapper for displaytag
Similar Threads
Adding css to display tag
how to add a numerator (index) in a displayTag?
displaytag should show only previous and next
struts with displayTag, any alternatives?
display tag export problem