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

  • Home
  • SEARCH
  • 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 7767237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:37:35+00:00 2026-06-01T15:37:35+00:00

I have acefaces datatable with file names, one on row and I’m trying to

  • 0

I have acefaces datatable with file names, one on row and I’m trying to add a download button using ice:outputResource, but I fails in sending the filename to outputResourceBean.

My datatable looks like:

<h:form id="exportedFiles">
       <ace:dataTable value="#{exportBean.allFiles}" var="upload" 

                    <ace:column>
                        <f:facet name="header" >
                            <h:outputText value="Název souboru"/>
                        </f:facet>    
                        <h:outputText value="#{upload.name}"/>
                    </ace:column>

                    <ace:column>
                        <f:facet name="header" >
                            <h:outputText value="Dowload file"/>
                        </f:facet>      
                        <ice:outputResource id="downLink" 
                                            resource="#{outputResource.pdfResource}"
                                            attachment="true"
                                            label="Download PDF"
                                            type="button">
                        </ice:outputResource>
                    </ace:column>
                </ace:dataTable>
            </h:form>

And my bean look like this:

public static final String PDF_NAME = "Download_PDF.pdf";
public static final Resource PDF_RESOURCE = new MyResource(PDF_NAME);
public String getPdfName() { return PDF_NAME; }
public Resource getPdfResource() { return PDF_RESOURCE; }

I can get the filename using #{upload.name} but I have no idea how to send it to bean when clicking the Download button…

Thanks for help in advance!

  • 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-06-01T15:37:37+00:00Added an answer on June 1, 2026 at 3:37 pm

    You can wrap your list containing the files into a ListDataModel. That allows you to access the data of the current selected row index.

    @ManagedBean
    @ViewScoped
    public class ExportBean {
    
        private ListDataModel<MyResource> allFiles;
    
        public ListDataModel<MyResource> getAllFiles() {
            if (allFiles == null) {
                List<MyResource> files = new ArrayList<MyResource>();
                files.add(new MyResource("doc1.pdf"));
                files.add(new MyResource("doc2.pdf"));
                files.add(new MyResource("doc3.pdf"));
                files.add(new MyResource("doc4.pdf"));
                files.add(new MyResource("doc5.pdf"));
                allFiles = new ListDataModel<MyResource>(files);
            }
            return allFiles;
        }
    
        public String getPdfName() {
            // add the getResourceName method to MyResource
            return allFiles.getRowData().getResourceName();
        }
    
        public Resource getPdfResource() {
            return allFiles.getRowData();
        }
    }
    

    And the xhtml page would look like this:

    <h:form id="exportedFiles">
        <ace:dataTable value="#{exportBean.allFiles}">
            <ace:column>
                <h:outputText value="#{exportBean.pdfName}" />
            </ace:column>
            <ace:column>
                <ice:outputResource resource="#{exportBean.pdfResource}" attachment="true" label="Download PDF" type="button" />
            </ace:column>
        </ace:dataTable>
    </h:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have any one tried to activate fancybox thumbnail gallery using a button or an
have a look at the code from an xml file where i am using
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
have been trying couple of hours now to make my iphone app universal. The
Have some code: using (var ctx = new testDataContext()) { var options = new
have Googled the cr*p out of this one so apologies if the answer is
Have a look at one of my websites: moskah.com The problem is that it
Have posting working wonderfully, and reading the response happily EXCEPT when one of the
Have a really weird one here. The app has two targets, just to be

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.