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 8907303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:52:54+00:00 2026-06-15T02:52:54+00:00

An example should hopefully demonstrate the issue. I have 10 documents that are displayed

  • 0

An example should hopefully demonstrate the issue. I have 10 documents that are displayed on the page, 3 of them have additional information contained inside zip packages. During the initial page load, I only know which documents have this additional information, I do not know the URL to these zip files. So then, I display a link (‘Get Zip Package’) to the 3 documents which contain additional zip files. When user clicks on ‘Get Zip Package’, it calls a method in the backing bean which goes to the database to figure out the URL of the zip package. Once this is done, I would like to serve the zip package to the browser which would then pop up as Save As… dialog and user can save the zip package.

I have tried two approaches but neither of them work.

Approach 1

<p:commandLink actionListener="#{myBackingBean.zipPackage(aDocument)}"
               value="Get Zip Package"
               ajax="false"
               rendered="#{aDocument.packageAvailable}"/>
public String zipPackage(DocItem item){
  //logic here to figure out the URL for this item's zip package
  return packageLink;
}

Approach 2

<h:outputLink onclick="getPackageLink([{name:'product', value: '#{aResult.product}'}, {name:'version',value:'#{aResult.version}'}])"
   <h:outputText value="Get Documentation Package"/>
</h:outputLink>
<p:remoteCommand name="getPackageLink" actionListener="#{kbBackingBean.zipPackage()}"/>
public String zipPackage() {
  Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
  String product = (String) map.get("product");
  String version = (String) map.get("version");
  //logic here to figure out the URL for this item's zip package
  return packageLink;
}

As the page loads and the 10 documents are displayed, the ‘Get Zip Package’ link (for the 3 documents) points to nothing, essentially has the same URL as the page. When I click on it, it sends a GET request to the server and calls the backing bean function as well. With approach 1, the browser does appear to wait for the backing bean method to finish before it begins rendering a response. With approach 2, there is no wait and the browser immediately reloads the page. I suspect that since the ‘Get Zip Package’ link points to the page itself, browser’s GET request gets processed first and the backing bean method’s response simply gets lost.

A third approach (I have not tried yet) which I suspect will work just fine is to invoke a Servlet which would then serve up the zip package. But seeing how I have a direct URL to the zip package, I was hoping there would be a way to serve that to the browser without getting a Servlet involved.

Any suggestion(s) or approach(es) which would allow me to use the URL without invoking a Servlet are most welcome. Of course, if Servlet is the only ‘proper’ way of doing this, I will certainly do that.

Thank you.

  • 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-15T02:52:55+00:00Added an answer on June 15, 2026 at 2:52 am

    You can try with this kind of logic :

    ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
    context.redirect(context.getRequestContextPath() + "download-page.jsf?product=" + product + "&version=" + version);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

World's most convuluted title I know, an example should explain it better. I have
For example Dim aInt as Integer should have the value as nothing instead of
To give you an example that you all should be familiar with, imagine that
For example, if I have these 2 Documents: id: 1 multifield: 2, 5 id:
Hopefully I'll be able to explain this well enough without an example... I have
Hopefully I am stating that right. I have a WinForm(3.5) app that has 1
The following jQuery example should put some text into the div, but it doesn't.
I am getting to know boost::variant. I think this example should work. #include <boost/fusion/sequence.hpp>
Possible Duplicate: C programming division in the following code example the result should yield
I should probably not ask a generic question with a specific example, but I

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.