Hi,
I'm having some problems implementing the examples on the display tag website for creating dynamic links using a table decorator.
I have the following setup:
I have a jsp page that displays my table (data is pulled from a database and put into a RowSetDynaClass):
<%
RowSetDynaClass new_ncs = ActionViewTables.newNCTabl
eSC(sdid_s
tring);
%>
<% request.setAttribute("new_
ncs_sc", new_ncs); %>
<display:table name="requestScope.new_ncs
_sc.rows" id="row" decorator="teska.displayta
g.Wrapper"
>
<display:column property="sfdid" title="ID" sortable="true"/>
<display:column property="level" title="Level" sortable="true"/>
<display:column property="form_name" title="Form Name" sortable="true"/>
<display:column property="last_name" title="System Coordinator" sortable="true"/>
<display:column property="date_submitted" title="Date Submitted" sortable="true" decorator="teska.displayta
g.LongDate
Wrapper"/>
<display:column property="scncviewlink" title="Take Action" />
</display:table>
I have created my own wrapper class as follows:
package teska.displaytag;
/**
* Licensed under the Artistic License; you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
*
http://displaytag.sourceforge.net/license.html *
* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*Originally from: package org.displaytag.sample;
*
*
*/
import java.text.DecimalFormat;
import java.util.*;
import org.apache.commons.lang.ti
me.FastDat
eFormat;
import org.displaytag.decorator.T
ableDecora
tor;
/**
* This class is a decorator of the TestObjects that we keep in our List. This class provides a number of methods for
* formatting data, creating dynamic links, and exercising some aspects of the display:table API functionality.
* @author epesh
* @author Fabrizio Giustina
* @version $Revision: 1.12 $ ($Author: fgiust $)
* modified by C Teska Race
*
*/
public class Wrapper extends TableDecorator{
/**
* FastDateFormat used to format dates in getDate().
*/
private FastDateFormat dateFormat;
/**
* DecimalFormat used to format money in getMoney().
*/
private DecimalFormat moneyFormat;
/**
* Creates a new Wrapper decorator who's job is to reformat some of the data located in our TestObject's.
*/
public Wrapper(){
super();
this.dateFormat = FastDateFormat.getInstance
("MM/dd/yy
"); //$NON-NLS-1$
this.moneyFormat = new DecimalFormat("$ #,###,###.00"); //$NON-NLS-1$
}
public String getScncviewlink(){
ListObject currRowObject = (ListObject)getCurrentRowO
bject();
String sfdid = (currRowObject.getSfdid())
;
return "\<a href=\"/displayView.jsp?sf
did=" + sfdid + "\"\>View\</a>";
}
/**
* Test method which always returns a null value.
* @return <code>null</code>
*/
public String getNullValue(){
return null;
}
/**
* Returns the date as a String in MM/dd/yy format.
* @return formatted date
*/
/*
public String getDate(){
return this.dateFormat.format(thi
s.getCurre
ntRowObjec
t().getDat
e());
}
*/
/**
* Returns the money as a String in $ #,###,###.00 format.
* @return String
*/
/*
public String getMoney(){
return this.moneyFormat.format(th
is.getCurr
entRowObje
ct().getMo
ney());
}
*/
}//close class
When I run this code I get the following error message:
500 Servlet Exception
Note: sun.tools.javac.Main has been deprecated.
/home/teska/public_html/sa
ndbox1/WEB
-INF/class
es/teska/d
isplaytag/
Wrapper.ja
va:64:
Class teska.displaytag.ListObjec
t not found.
ListObject currRowObject = (ListObject)getCurrentRowO
bject();
^
/home/teska/public_html/sa
ndbox1/WEB
-INF/class
es/teska/d
isplaytag/
Wrapper.ja
va:64:
Class teska.displaytag.ListObjec
t not found.
ListObject currRowObject = (ListObject)getCurrentRowO
bject();
^
2 errors, 1 warning
Resin 2.1.16 (built Tue Feb 15 11:12:27 PST 2005)
My questions are:
1: Where do I get the ListObject class and where do I put it to have ot work - does it need additional classes to work?
2. I'm not clear how I access the value of sfdid (the first value in each row of my RowSetDynaClass). The examples talk about getId() and getListIndex(), but it is not at all clear which one is the value of a specific object - if either one of them actually are that.
Please let me know if I can provide any additional info
Thanks,
Courtenay