Hi Nick
Yes, I inderstand that AJAX is not intended for binary tansfers - I am using h:commandLink to initiate - the problem arises when I open an .xls and thne subsequently select the rich:menuItem - initially, the newDocModalPanel panel opens - but then immediately closes and the main page attempts to render a .xls object
product_tree.jsp Page Code:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../joshua.css">
<title>Joshua</title>
</head>
<body>
<f:view>
<div align="center">
<%@ include file="../WEB-INF/jspf/header.jspf" %>
<%@ include file="../WEB-INF/jspf/menubar.jspf" %>
<%@ include file="../WEB-INF/jspf/product_tree_body.jspf" %>
<%@ include file="../WEB-INF/jspf/footer.jspf" %>
</div>
</f:view>
</body>
</html>
product_tree_body.jspf code: - I've highlighted the link and menu item...
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<a4j:keepAlive beanName="ProductBean" />
<rich:modalPanel id="editDocModalPanel" autosized="true" width="400"
moveable="true" resizeable="false" >
<f:facet name="header"><h:outputText value="Edit Document Detail"></h:outputText>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/images/modal/close.png" styleClass="hidelink" id="editdochidelink"/>
<rich:componentControl for="editDocModalPanel" attachTo="editdochidelink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
<h:form id="editform">
<rich:panel>
<h:outputText value="" />
<h:inputHidden id="edocid" value="#{ProductBean.editDoc.id}" />
<h:inputHidden id="edocfd" value="#{ProductBean.editDoc.fdata}" />
<h:inputHidden id="edocel" value="#{DocumentEditBean.editDoc.element}" />
<h:inputHidden id="edocmt" value="#{ProductBean.editDoc.mimetype}" />
<h:inputHidden id="edocci" value="#{ProductBean.editDoc.classid}" />
<h:inputHidden id="edocst" value="#{ProductBean.editDoc.status}" />
<h:inputHidden id="edocmo" value="#{ProductBean.editDoc.modifier}" />
<h:panelGrid id="edocgrid" columns="2" >
<h:outputText value="Company" /><h:inputText disabled="true" id="edocco" value="#{ProductBean.editDoc.customer_id}" />
<h:outputText value="Document Class" /><h:inputText disabled="true" id="edocpr" value="#{ProductBean.editDoc.product_id}" />
<h:outputText value="Title" /><h:inputText id="edocti" value="#{ProductBean.editDoc.title}" />
<h:outputText value="Description" /><h:inputText id="edocds" value="#{ProductBean.editDoc.description}" />
<h:outputText value="Narrative" /><h:inputText id="edocnr" value="#{ProductBean.editDoc.narr}" />
<h:outputText value="Archive Location" /><h:inputText id="edocar" value="#{ProductBean.editDoc.archived}" />
<h:outputText value="Document Date" /><rich:calendar id="edocdd" value="#{ProductBean.editDoc.ddate}" />
<h:outputText value="Retention Years" /><h:inputText id="edocry" disabled="true" value="#{ProductBean.editDoc.ryears}" />
<h:outputText value="Retention Date" /><rich:calendar id="edocrd" disabled="true" value="#{ProductBean.editDoc.rdate}" />
<h:outputText value="File Name" /><h:inputText id="edocfn" disabled="true" value="#{ProductBean.editDoc.fname}" />
<a4j:commandLink id="editsave" immediate="true" action="#{ProductBean.saveEditDoc}" reRender="documentTable" value="Save" >
<rich:componentControl for="editDocModalPanel" attachTo="editsave" operation="hide" event="onclick"/>
</a4j:commandLink>
</h:panelGrid>
</rich:panel>
</h:form>
</rich:modalPanel>
<rich:modalPanel id="newDocModalPanel" autosized="true" width="400"
moveable="true" resizeable="false" >
<f:facet name="header"><h:outputText value="New Document Detail"></h:outputText>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/images/modal/close.png" styleClass="hidelink" id="newdochidelink"/>
<rich:componentControl for="newDocModalPanel" attachTo="newdochidelink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
<h:form>
<rich:panel>
<h:panelGrid id="docgrid" columns="2" >
<h:outputText value="Company" /><h:inputText id="docco" value="#{ProductBean.updateDoc.customer_id}" />
<h:outputText value="Document Class" /><h:inputText id="docpr" value="#{ProductBean.updateDoc.product_id}" />
<h:outputText value="Title" /><h:inputText id="docti" value="#{ProductBean.updateDoc.title}" />
<h:outputText value="Description" /><h:inputText id="docds" value="#{ProductBean.updateDoc.description}" />
<h:outputText value="Narrative" /><h:inputText id="docnr" value="#{ProductBean.updateDoc.narr}" />
<h:outputText value="Archive Location" /><h:inputText id="docar" value="#{ProductBean.updateDoc.archived}" />
<h:outputText value="Document Date" /><rich:calendar id="docdd" value="#{ProductBean.updateDoc.ddate}" />
<h:outputText value="Retention Years" /><h:inputText id="docry" disabled="true" value="#{ProductBean.updateDoc.ryears}" />
<h:outputText value="Retention Date" /><rich:calendar id="docrd" disabled="true" value="#{ProductBean.updateDoc.rdate}" />
<h:outputText value="File Name" /><h:inputText id="docfn" disabled="true" value="#{ProductBean.updateDoc.fname}" />
</h:panelGrid>
<h:inputHidden value="#{ProductBean.updateDoc.id}" />
<h:inputHidden value="#{ProductBean.updateDoc.fdata}" />
<h:inputHidden value="#{ProductBean.updateDoc.element}" />
<h:inputHidden value="#{ProductBean.updateDoc.mimetype}" />
<h:inputHidden value="#{ProductBean.updateDoc.classid}" />
<h:inputHidden value="#{ProductBean.updateDoc.status}" />
<h:inputHidden value="#{ProductBean.updateDoc.modifier}" />
<p>Upload and save</p>
<rich:fileUpload fileUploadListener="#{ProductBean.listener}"
maxFilesQuantity="1"
id="doc"
alt="#{ProductBean.document.id}"
immediateUpload="false"
acceptedTypes="jpg, gif, png, bmp, pdf, xls, doc" allowFlash="false" autoclear="true" listHeight="50px" listWidth="300px">
<a4j:support event="onuploadcomplete" reRender="documentTable, docgrid, docco, docpr, docti, docds, docnr, docar, docdd, docry, docrd, docfn" requestDelay="200"/>
</rich:fileUpload>
</rich:panel>
</h:form>
</rich:modalPanel>
<rich:panel style="width: 900px" >
<div align="left">
<h:panelGrid columns="2" columnClasses="aligntop, aligntop" >
<h:form>
<h:panelGrid style="width: 270px" columns="1" >
<rich:tree ajaxSubmitSelection="true"
nodeSelectListener="#{ProductBean.selectionListener}"
switchType="client"
id="tree"
reRender="selectedProduct, documentTable, tableHeader, newDocModalPanel, editDocModalPanel"
preserveModel="request"
binding="#{ProductBean.productTree}" >
<rich:treeNode >
<h:outputText value="#{item.label}" />
</rich:treeNode>
</rich:tree>
</h:panelGrid>
</h:form>
<h:form>
<h:panelGrid style="width: 600px" columns="1" id="selectedProduct" >
<rich:dataTable onRowMouseOver="this.className='highlight'"
onRowMouseOut="this.className='normal'"
reRender="ds"
width="100%"
id="documentTable"
sortMode="single"
value="#{ProductBean.documents }"
var="document"
rows="20">
<f:facet name="header"><h:outputText id="tableHeader" value="#{ProductBean.selectedCustomerProduct.header}"/>
</f:facet>
<rich:column sortBy="#{document.title}" filterBy="#{document.title}" filterEvent="onkeyup">
<f:facet name="header" ><h:outputText value="Title"></h:outputText></f:facet>
<h:outputText value="#{document.title}" ></h:outputText>
</rich:column>
<rich:column sortBy="#{document.description}" filterBy="#{document.description}" filterEvent="onkeyup">
<f:facet name="header" ><h:outputText value="Description"></h:outputText></f:facet>
<h:outputText value="#{document.description}" ></h:outputText>
</rich:column>
<rich:column sortBy="#{document.fname}" filterBy="#{document.fname}" filterEvent="onkeyup">
<f:facet name="header" ><h:outputText value="Original File"></h:outputText></f:facet>
<h:outputText value="#{document.fname}" ></h:outputText>
</rich:column>
<rich:column >
<f:facet name="header" ><h:outputText value="Open"></h:outputText></f:facet>
<h:commandLink immediate="true" action="#{ProductBean.actionOpenDocument}" value="Open" >
<a4j:actionparam name="docid" value="#{document.id}" ></a4j:actionparam>
</h:commandLink>
<h:outputText value=" "/>
</rich:column>
<rich:column>
<f:facet name="header" ><h:outputText value="Edit"></h:outputText></f:facet>
<a4j:commandLink immediate="true" oncomplete="#{rich:component('editDocModalPanel')}.show()"
reRender="editform"
action="#{ProductBean.actionEditDocument}" value="Edit" >
<a4j:actionparam name="docid" value="#{document.id}" ></a4j:actionparam>
</a4j:commandLink>
</rich:column>
<f:facet name="footer" >
<rich:datascroller status="waitStatus" id="ds" reRender="documentTable" align="center" for="documentTable" maxPages="10" />
</f:facet>
</rich:dataTable>
<rich:toolBar style="width: 600px; text-align: left;"><rich:menuItem id="adddoc" submitMode="ajax" value="Add Document" >
<rich:componentControl attachTo="adddoc" for="newDocModalPanel" operation="show" event="onclick"/>
</rich:menuItem></rich:toolBar>
</h:panelGrid>
</h:form>
</h:panelGrid>
</div>
</rich:panel>