Simon Kitching wrote:
The solution I ended up with was for a page to use <t:outputLink> to
render a list of links to available documents. Each link looks like:
<h:outputLink value="/showDoc" target="document">
<f:param name="docId" value="#{row.id}"/>
<t:outputText value="#{row.docName}"/>
</h:ouputLink>
Nice to learn about alternative ways of solving a problem you're faced
with. Thanks for posting the details Simon.
My solution ended up looking a bit different since I needed to stream
the content from a backing bean method.
the form:
<afh:body onload="if(typeof openReport != 'undefined') openReport();">
<h:form>
<!-- ... -->
<h:commandButton value="doIt"
actionListener="#{reportSelectionHandler.fetchReport}"/>
</h:form>
<h:form id="reportOpener" target="report">
<h:inputHidden value="dummy"/>
<h:commandButton id="reportOpenerSubmit" type="submit"
styleClass="hidden-object"
actionListener="#{reportSelectionHandler.downloadReport}"/>
<t:div rendered="#{reportSelectionHandler.openReportWindow}">
<f:verbatim>
<script type="text/javascript">
<![CDATA[
function openReport() {
submitForm('reportOpener',1,{source:'reportOpener:reportOpenerSubmit'});
}
]]>
</script>
</f:verbatim>
</t:div>
</h:form>
ReportSelectionHandler backing bean:
public void fetchReport(ActionEvent event) {
// ...
openReportWindow = true;
}
public void downloadReport(ActionEvent event) {
// stream content to the new browser window
}
i experienced some weird problems with Firefox 2.0.3 on Windows.
Sometimes the popup blocker just starts blocking the new window though
the server is on the allowed sites list. When i restart Firefox
everything works again.
regards,
marko