Search code examples
richfacesajax4jsf

command link opening new window but no rich:panel attribute is coming inside that window in jsf


I am using Richfaces. I have a command link which is opening a new window. The new window is showing data from backing bean but the rich:panel or rich:datatable are not showing properly.

This is the command link I have used:

<a4j:commandLink id="viewmodel" immediate="true" value="View Model" action="#{modeloutput.viewModel}" oncomplete="window.open('modelview.jsf')">
    <f:setPropertyActionListener target="#{modeloutput.modelname}" value="#{recentmodel.recentModel}"></f:setPropertyActionListener>
    <f:setPropertyActionListener target="#{modeloutput.runDate}" value="#{recentmodel.modelRunDate}"></f:setPropertyActionListener>

This is my modelview.xhtml:

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <head>

    </head>

    <BODY>
    <h:form>
<rich:panel>
<h:outputText value="Model description of #{modeloutput.modelname} Will display here run on #{modeloutput.runDate}"></h:outputText>
</rich:panel>
<rich:dataTable id="viewmodel">
<rich:column>
<f:facet name="header">
<h:outputText value="Model Version"></h:outputText>
</f:facet>
<h:outputText value="#{modeloutput.modelname}"></h:outputText>
</rich:column>

</rich:dataTable>

    </h:form>
    </BODY>
</html>

But in the new window I am not getting any panel border and datatable is showing only header portion.

Please help as soon as possible.


Solution

  • You have to use <h:head> otherwise the resources won't be imported.