0

I created a sample project with Netbeans 8 using Glassfish 4.
I created entity classes from database, then created JSF pages from those entity classes (from templates in Netbeans).
However, when I click on view button it shows regarding database entry in dialog box in the same window.

This is the command button which shows the dialog box:

<p:commandButton id="viewButton"   icon="ui-icon-search" value="#{bundle.View}" update=":CustomerViewForm" oncomplete="PF('CustomerViewDialog').show()" disabled="#{empty customerController.selected}"/>

This is the dialog box I want to open in seperate window

This is the View.xhtml file viewButton refers:

<ui:composition>

    <p:dialog id="CustomerViewDlg" widgetVar="CustomerViewDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.ViewCustomerTitle}">
        <h:form id="CustomerViewForm">
            <h:panelGroup id="display">
                <p:panelGrid columns="2" rendered="#{customerController.selected != null}">
                    <h:outputText value="#{bundle.ViewCustomerLabel_customerId}"/>
                    <h:outputText value="#{customerController.selected.customerId}" title="#{bundle.ViewCustomerTitle_customerId}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_name}"/>
                    <h:outputText value="#{customerController.selected.name}" title="#{bundle.ViewCustomerTitle_name}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_addressline1}"/>
                    <h:outputText value="#{customerController.selected.addressline1}" title="#{bundle.ViewCustomerTitle_addressline1}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_addressline2}"/>
                    <h:outputText value="#{customerController.selected.addressline2}" title="#{bundle.ViewCustomerTitle_addressline2}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_city}"/>
                    <h:outputText value="#{customerController.selected.city}" title="#{bundle.ViewCustomerTitle_city}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_state}"/>
                    <h:outputText value="#{customerController.selected.state}" title="#{bundle.ViewCustomerTitle_state}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_phone}"/>
                    <h:outputText value="#{customerController.selected.phone}" title="#{bundle.ViewCustomerTitle_phone}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_fax}"/>
                    <h:outputText value="#{customerController.selected.fax}" title="#{bundle.ViewCustomerTitle_fax}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_email}"/>
                    <h:outputText value="#{customerController.selected.email}" title="#{bundle.ViewCustomerTitle_email}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_creditLimit}"/>
                    <h:outputText value="#{customerController.selected.creditLimit}" title="#{bundle.ViewCustomerTitle_creditLimit}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_discountCode}"/>
                    <h:outputText value="#{customerController.selected.discountCode}" title="#{bundle.ViewCustomerTitle_discountCode}"/>
                    <h:outputText value="#{bundle.ViewCustomerLabel_zip}"/>
                    <h:outputText value="#{customerController.selected.zip}" title="#{bundle.ViewCustomerTitle_zip}"/>
                </p:panelGrid>
                <p:commandButton value="#{bundle.Close}" onclick="CustomerViewDialog.hide()"/>
            </h:panelGroup>
        </h:form>
    </p:dialog>

</ui:composition>


              

I want to see the dialog box in separate window.
How should I change the project to see this dialog box in new window? I tried changing button to a commandLink, adding action attribute to redirect to View.xhtml, adding target="_blank", etc. but couldn't find proper solution.

Community
  • 1
  • 1

0 Answers0