First : Unless you have only one person accessing this report you do know that using a fixed path like you have means that if there are two requests at the same time - the results are not known - most probably one will not get a file or will see the other's data. In some cases the file can be corrupted.
You need to save the data with a random name on the server (you can use the java.io.File.createTempFile(String "3-char-min", String ".xls", File directoryOnServer)
Now after making a new file, in the page after button click you need to set the content type in the page to application excel BEFORE any output, and the only output should be the binary data. I do not know about rich faces but in jsps have seen people insert new lines in the header between the jsp tags.
Example
<%@ page import="sel2in.prjx.conf.*, sel2in.urlShorten.data.*, sel2in.prjx.common.*"%>
<%
///this is bad : new line after %>
response.setHeader("pragma","No-cache");
Correct way
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <% response.setContentType("application/vnd.ms-excel"); %><%@ page import="sel2in.prjx.conf.*, sel2in.urlShorten.data.*, sel2in.prjx.common.*"%><%
///this is okay : No new line after %>
response.setHeader("pragma","No-cache");
For rich faces see File download using RichFaces
(below copied from there)
<h:commandLink value="Download" action="#{appController.downloadFile}"
rendered="#{!file.directory}">
<f:param name="file" value="#{file.absoluteFilename}" />
</h:commandLink>
As to setting the content type, if you have a file name with extension at your hands, you could use ServletContext#getMimeType() to resolve it based on in web.xml (either the server's default one or your webapp's one).
ServletContext servletContext = (ServletContext) externalContext.getContext();
String contentType = servletContext.getMimeType(file.getName());
if (contentType == null) {
contentType = "application/octet-stream";
}
response.setContentType(contentType);
// ...
(note this is for JSF 1.x, you could since JSF 2.x otherwise also use ExternalContext#getMimeType())