Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=4119964 By: courtenayt
Hi, I'm having some problems implementing the examples used to create 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.newNCTableSC(sdid_string); %> <% request.setAttribute("new_ncs_sc", new_ncs); %> <display:table name="requestScope.new_ncs_sc.rows" id="row" decorator="teska.displaytag.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.displaytag.LongDateWrapper"/> <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.time.FastDateFormat; import org.displaytag.decorator.TableDecorator; /** * 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)getCurrentRowObject(); String sfdid = (currRowObject.getSfdid()); return "\<a href=\"/displayView.jsp?sfdid=" + 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(this.getCurrentRowObject().getDate()); } */ /** * Returns the money as a String in $ #,###,###.00 format. * @return String */ /* public String getMoney(){ return this.moneyFormat.format(this.getCurrentRowObject().getMoney()); } */ }//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/sandbox1/WEB-INF/classes/teska/displaytag/Wrapper.java:6 4: Class teska.displaytag.ListObject not found. ListObject currRowObject = (ListObject)getCurrentRowObject(); ^ /home/teska/public_html/sandbox1/WEB-INF/classes/teska/displaytag/Wrapper.java:6 4: Class teska.displaytag.ListObject not found. ListObject currRowObject = (ListObject)getCurrentRowObject(); ^ 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 ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=249318 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user