Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=4760293 By: mahanth
i am using display tag 1.1.1( http://displaytag.sourceforge.net/11/ )to display data and export data to an excel file in struts 1.2 though i am able to display the table successfully on the jsp page ...the excel file is empty i have already tried configuring the export filter but that doesnt do a thing. i have been trying to get this to work for the past 2 days in vain ...what am i missing???? my entire code: welcome page:------------------------------------- <%@ page language="java"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <%@ taglib uri="/WEB-INF/c.tld" prefix="c"%> <html> <head> <title></title> </head> <body bgcolor="white"> <a href = "trialDo.do">link to the action</a> </body> </html> --------------------------------------------------------------------------- destination page:--------------------------------------------------------- <%@ taglib uri="http://displaytag.sf.net" prefix="display" %> <%@ page language="java"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%> <%@ taglib uri="/WEB-INF/c.tld" prefix="c"%> <%@ page buffer = "16kb" %> <html> <body> </br></br> <display:table name = "tryForm.tryList" export = "true" id = "currrowobj"> <display:column property="name" title="Name"/> <display:column property="desig" title = "Designation"/> </display:table> </body> </html> --------------------------------------------------------------------------- action and bean config in struts-config.xml:------------------------------- <action-mappings> <action path="/trialDo" type="trialpack.TrialAction" name="tryForm" scope="request" > <forward name = "success" path = "/pages/trialdispjsp.jsp"/> </action> </action-mappings> <form-beans> <form-bean name="tryForm" type="trialpack.TryForm"/> </form-beans> -------------------------------------------------------------------------- Action class:------------------------------------------------------------- package trialpack; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class TrialAction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ TryForm tF = (TryForm)form; List<TrialObj> tlist = new ArrayList<TrialObj>(); for(int i = 0; i < 5 ; i++){ TrialObj tB = new TrialObj(); String name = "Name"+i; System.out.println(name); tB.setName(name); tB.setDesig(name); tlist.add(tB); } tF.setTryList(tlist); for(int i = 0; i < 5; i++) { System.out.println("hello"); System.out.println(tF.getTryList().get(i).getName()); } return (mapping.findForward("success")); } } --------------------------------------------------------------------------- formbean:------------------------------------------------------------------ package trialpack; import java.util.List; import org.apache.struts.action.ActionForm; public class TryForm extends ActionForm{ private static final long serialVersionUID = 1L; private List<TrialObj> tryList; public List <TrialObj> getTryList() { return tryList; } public void setTryList(List <TrialObj> tryList) { this.tryList = tryList; } } --------------------------------------------------------------------------- trialobj:------------------------------------------------------------------ package trialpack; public class TrialObj { private String name = ""; private String desig = ""; public String getDesig() { return desig; } public void setDesig(String desig) { this.desig = desig; } public String getName() { return name; } public void setName(String name) { this.name = name; } } --------------------------------------------------------------------------- export filter config in web.xml:------------------------------------------- <filter> <filter-name>ResponseOverrideFilter</filter-name> <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class> </filter> <filter-mapping> <filter-name>ResponseOverrideFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ResponseOverrideFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> --------------------------------------------------------------------------- properties file: --------------------------------------------------------------------------- #sort.behavior=list #sort.amount=list #basic.empty.showtable=true #basic.msg.empty_list=No results matched your criteria. #paging.banner.placement=top #paging.banner.onepage= export.types=csv excel xml export.excel=true export.csv=true export.xml=true export.excel.class=org.displaytag.export.excel.DefaultHssfExportView # if set, file is downloaded instead of opened in the browser window export.excel.filename=excel.xls --------------------------------------------------------------------------- another seemingly bizzare thing i noticed was that the table wont show up on the jsp page if i change the action scope to session from request or even if i remove the attribute altogether ______________________________________________________________________ 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 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user