473,699 Members | 2,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export to CSV Text File in Struts: .findforward not loading after.

My Struts application is attempting to export the contents of a table to a CSV text file.
I have gotten this to work in the past but am now having trouble after the export in getting
the mapping.findfor ward to function properly. In the past, the export worked, and after it
was complete, the mapping.findfor ward would load the appropriate page, either success.jsp or
failure.jsp depending.

Am I missing an obvious step here? It never encounters an exception, it sets forwardPage
correct, and it executes the findForward, but the page is never displayed. If I take out
the export piece of the code, the findforward displays the appropriate page. I have
been backward and forward in thmy double checking against the functioning version of the
feature, and can't see what I am missing.

Thanks for any help.

Skip
=============== =============== =============== =============== =============== =====
// If the session has not timed out.
if (request.isRequ estedSessionIdV alid())
{
BeanOperatorInf ormation beanOperatorInf ormation = null;
HttpSession session = request.getSess ion(true);

beanOperatorInf ormation = (BeanOperatorIn formation)sessi on.getAttribute ("beanOperatorI nformation");
if (null != beanOperatorInf ormation)
{
BeanQuery beanQuery = (BeanQuery)sess ion.getAttribut e("beanQuery" );

beanQuery.query RP(localForm.ge tRateTable1(),
localForm.getRa teTable2(), localForm.getRa teTable3(),
localForm.getRa teTable4(), localForm.getRa teTable5(),
localForm.getRa teTable12());

// Now...Let's Export the son of a gun
if (logger.isDebug Enabled())
{
logger.debug("E xporting Tables to Disk... ");
}

ServletOutputSt ream out = response.getOut putStream();
// ---------------------------------------------------------------
// Set the output data's mime type
// ---------------------------------------------------------------
response.setCon tentType("appli cation/text");
response.setHea der("Content-disposition", "filename=\"Rat eTables.csv\"") ;
out.println("Co lumn1,Column2,C olumn3,Column4" );
Iterator iter = beanQuery.getLi stRP().iterator ();
// This returns 5 elements
while (iter.hasNext() )
{
iter.next();
// the following is static garbage until the db connection is worked out later
out.println("AA AAAAAAAAAAAAA" + "," + "BBBBBBBBBB BBB" + "," + "CCCCCCCCCC C" + "," + "DDDDDDDDDDDDD" );
}
out.flush();
// Done Exporting
forwardPage = "success";
}
else
{
forwardPage = "disconnect ed";
}
}
else
{
forwardPage = "sessiontimeout ";
}
}
catch (com.att.apt.Ex ceptionApt except)
{
ActionErrors errors = new ActionErrors();
Logger logger = Logger.getLogge r(ActionExportR T.class);

if (!except.isEmpt y())
{
ActionError actionError = null;
Iterator errorIterator = except.getListA ctionErrors().i terator();

while (errorIterator. hasNext())
{
errors.add("loa derror", (ActionError)er rorIterator.nex t());
}
}
else
{
describeExcepti on(errors, except);
}

saveErrors(requ est, errors);

logger.error("A PT Exception: " + except);
}
catch (java.lang.Exce ption except)
{
ActionErrors errors = new ActionErrors();
Logger logger = Logger.getLogge r(ActionExportR T.class);

describeExcepti on(errors, except);
saveErrors(requ est, errors);

logger.error("E xception: " + except);
}
return mapping.findFor ward(forwardPag e);
}
Jul 18 '05 #1
0 7663

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2284
by: Moreno | last post by:
Hi, I'm trying to make my first struts application and I'm fighting with authentication and roles. I've only one jsp page (index.jsp) that prints authentication type ("BASIC") and user roles. <% authentication+="Authentication " + request.getAuthType();
10
7680
by: ls | last post by:
Hi All, I looking for help with ZODB data export to text file. I have file Data.fs (file becomes from Plone CMS) and I have to display content structure, data like intro, body of article, etc and save it in to simple file. However I can't use Plone XML export because is broken, Zope Corp. set low priority for this bug, so I have to find other way how to digg in to data. Could you point me in to some Python code examples, code...
5
11034
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after setting stDataSource and stFileName to the desired values. Most of the time it works, but occasionally, typically as code changes are being made to the module, the following message appears:
4
2066
by: Jay | last post by:
This is a strange one that I can't seem to find a fix for. We have a Billing DB application (Access 2000 format) where we upload billing info in a comma delimited text file to our printer who prints and mails our bills. The application basically creates a table then exports a comma delimited file of that table. The problem is that we keep getting one seemingly random record in the text file that is misaligned. The record in question is...
3
3046
by: excyauseme | last post by:
Hi guys! Do you know what is the best way to export a text file, this one is a log file that is already comma delimited thru a module run by my access database, to an excel spreadsheet? I need to do this thru the module, and I don't see how I can export a txt file from access without loading it to a temp table first. I've checked out the DoCmd.TransferText methods, where you have to have a table or query or schema ini first, and the...
3
6007
by: hbarnett | last post by:
I am in process of converting Access 97 databases to Access 2003. Some of the Access 97 databases export data to a text file with a non standard file extension, such as "ext" or "NAL". When I try to run the export in the converted Access 2003 database, I get the error "Cannot update: Database or object is read-only." It seems that the real problem is that I can only export a text file if I use either "txt", "csv", "tab", or "asc" as...
0
2296
by: Laxmikumar | last post by:
Iam new to web services, Iam using net beans-5.5.1 IDE whlie deploying the web service application the following error is occured. can anyone help me..??? please. init: deps-module-jar: deps-ear-jar: deps-jar: library-inclusion-in-archive: library-inclusion-in-manifest:
0
1581
VietPP
by: VietPP | last post by:
Hi all, I've asked too much question in this day, hehe. I'm trying to export my table data in OracleDB to excel. The problem is my charset in database is US7ACSII (using Vietnamese font), when I exprort to excel it's changed to Unicode UTF-8 so all of the characters had lost, text cannot be display correctly. Is it possible to add a charset setting to code. Thank you!
4
3627
by: grumpydadtl | last post by:
I am exporting a text file from Access that will be fed into a mainframe application (third party - not something I manage). The file contains a header record, body - which is the variable number of records to be imported into the mainframe, and a trailer record. Upon export, Access automatically places a hard return after the trailer record - creating a new line after the trailer - albeit with no data on that line. How can I create the...
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.