我使用Glassfish 4使用Netbeans 8创建了一个示例项目
我从数据库创建了实体类,然后从这些实体类(从Netbeans中的模板)创建了JSF页面。
但是,当我单击视图按钮时,它会在同一窗口的对话框中显示有关数据库条目的信息。
这是显示对话框的命令按钮:
<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
这是View.xhtml文件viewButton指的是:
<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>
我想在单独的窗口中看到对话框。
我该如何更改项目以在新窗口中看到此对话框?
我尝试将按钮更改为commandLink,添加操作属性以重定向到View.xhtml,添加target =“_ blank”等,但找不到合适的解决方案。