Hi,

sure you can. Set a special http-header. fi:

Content-Disposition: attachment; filename=MyFileName.csv

use attachment to force 'save as...' dialog or inline for default browser integration. filename has a special encoding. see http://www.ietf.org/rfc/rfc2231.txt and http://www.ietf.org/rfc/rfc2184.txt

regards
thomas

[email protected] schrieb:
Hello,

in my application if a page, where a search can be performed and the result is shown on the same page in form of a list.

On the page, the user has a button (action widget) that returns him the search result as a csv file. That's not a problem, this works. The problem I have is the filename. The file is named as the current page is. Somesing crypted with continuation id and .continue at die end. Can I set the name of the file, the csv is serialized to the user?

Here my current code:

flowscript:

list() {

      //some code

var form = new Form("pages/form/list_model.xml");
      form.createBinding("pages/form/list_binding.xml");

      while(true) {
            form.load(to);
            form.showForm("list.form", {
                  itemList:itemList
            });
            form.save(to);
var action = form.submitId;
            if ("search".equals(action)) {
itemList = BridgeFactory.getInstance().getDummyBridge().search(context, to);
            } else if ("resetButton".equals(action)) {
                  to = new SearchTO();
                  itemList = null;
            } else if ("csv".equals(action)) {
                  cocoon.sendPage("list.csv", {itemList:itemList});
                  break;
            }
      }
}

sitemap:

<map:serializer name="csv" mime-type="application/x-csv" src="org.apache.cocoon.serialization.TextSerializer">
    <encoding>ISO-8859-1</encoding>
    <omit-xml-declaration>yes</omit-xml-declaration>
</map:serializer>


<map:match pattern="*.csv">
   <map:generate src="pages/csv/{1}.csv"/>
   <map:transform type="jx"/>
   <map:transform src="stylesheets/csv.xsl" />
   <map:transform type="dbi18n">
      <map:parameter name="locale" value="{../locale}" />
   </map:transform>
   <map:serialize type="csv" />
</map:match>

Thanks,

Mike

--
Thomas Markus

====================================================
proventis GmbH | Zimmerstr. 79-81 | D-10117 Berlin |
Tel +49 (0)30 2936399-22 | Fax -50 | [email protected]
-----------------------------------------------------------------
Geschäftsführer: Norman Frischmuth | Sitz: Berlin
Handelsregister: AG Berlin-Charlottenburg, HR 82917
-----------------------------------------------------------------
Blue Ant-webbasiertes Projektmanagement - aktuelle Termine 2008:
http://www.proventis.net/website/live/blueant/veranstaltungen.html
====================================================

begin:vcard
fn:Thomas Markus
n:Markus;Thomas
org:proventis GmbH
adr:;;Zimmerstr. 79-80;Berlin;Berlin;10117;Germany
email;internet:[email protected]
tel;work:+49 30 29 36 399 22
x-mozilla-html:FALSE
url:http://www.proventis.net
version:2.1
end:vcard

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to