Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5947253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:56:17+00:00 2026-05-22T16:56:17+00:00

I need to add an ‘export’ function to an existing web app using seam.

  • 0

I need to add an ‘export’ function to an existing web app using seam. The purpose is to export search results to a csv file. I have no problem generating a csv, but I do not know how the send the csv back to the user.
I do not want to store the csv on the server because that would be waisted storage space. How could I achieve this in jboss seam?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:56:18+00:00Added an answer on May 22, 2026 at 4:56 pm

    Use the Document Store Servlet provided by Seam.

    Almost copying and pasting from the reference doc, declare the servlet in web.xml like this:

    <servlet>
        <servlet-name>Document Store Servlet</servlet-name>
        <servlet-class>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>Document Store Servlet</servlet-name>
        <url-pattern>/seam/docstore/*</url-pattern>
    </servlet-mapping>
    

    Then create a export.xhtml file with only <s:resource> tag:

    <s:resource xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                data="#{myComponent.csvData}"
                contentType="application/vnd.ms-excel"
                fileName="#{myComponent.csvFileName}"/>
    

    Generate link for downloading the file in your page with <s:download>:

    <s:download src="/csv/export.xhtml">
        <h:outputText value="Download CSV"/>
        <f:param name="param1" value="somevalue"/>
        <f:param name="param2" value="someOtherValue"/>
    </s:download>
    

    Finally, implement getCsvData() and getCsvFileName() methods in your component:

    // could be byte[], File or InputStream
    public InputStream getCsvData() {
        // generate data to be downloaded
    }
    
    public String getCsvFileName() {
       return "myfile.csv";
    }
    

    Note that <s:download> propagates conversation (unless you set propagation=none). If you propagate the conversation context probably you won’t need to pass any parameter. For large data set it may be preferable to not propagate the conversation and pass parameter to select the data in a request scoped component.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add full web search to my site. I need something like
i need Add Row Numbers To a SELECT Query without using Row_Number() function. and
I need to add a web part zone to a wiki page. I'm opening
I need to add multiple empty divs to a container element using jQuery. At
I need to add some function that returns a value to a dom element.
I just built a asp.net 2.0 web site. Now I need add REST web
I need to add gallery to my android app. I used gallery in standard
Need to add users/roles etc to my web application. I want to use aspnetdb,
I need to add many entries to my web.config file for many websites. I
I need to add a real-time element to my web application. Basically, I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.