Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=4147106 By: courtenayt
I've solved the problem with help from people on expert exchange. For all who would benefit, here is what I did: Using a table wrapper I can create a dynamic link. In the method in the Wrapper that creates a dynamic link, I can access the database and get additional info to append to the dynamic URL. Note - table wrappers and column wrappers cannot exist on the same table - anything you want to have in a column wrapper will have to be put into the table wrapper or all sorts of ugly errors will appear. Here is what works for the Wrapper class: 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.displaytag.sample.*; import org.apache.commons.lang.time.FastDateFormat; import org.apache.commons.beanutils.*; 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: getLink2() changed by C. Teska January 11, 2005 */ public class Wrapper extends TableDecorator{ /** * Creates a new Wrapper decorator who's job is to reformat some of the data located in our TestObject's. */ public Wrapper(){ super(); } public String getScNcViewLink(){ BasicDynaBean rowObject = (BasicDynaBean) getCurrentRowObject(); Integer sfdid = (Integer) rowObject.get("sfdid"); int sfdid_int = sfdid.intValue(); String sfdid_string = Integer.toString(sfdid_int); // Here is where I could access the database and use the sfdid_string to // obtain an additional value from the database and append that String // to the url below instead of the sfdid_string. return "<a href = \"/sandbox1/displayView.jsp?sfdid=" + sfdid_string + "\">View</a>"; } } Here is what works in my nc_lists.jsp: <% 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"/> <display:column property="scNcViewLink" title="View" /> </display:table> ______________________________________________________________________ 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 ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user