コードを簡素化するために、primefaces ダイアログ フレームワークを使用しようとしています。primefaces 4.0 ユーザー ガイドの例に従いましたが、機能しません。
この例をほぼそのままコピーして、ダイアログを含むファイル、ダイアログを呼び出すファイル、およびバッキング Bean ファイルの 3 つのファイルを作成しました。
ダイアログ ファイルは「dialog.xhtml」という名前で、「/Test」フォルダにあり、以下が含まれています。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Cars</title>
</h:head>
<h:body>
Test dialog
</h:body>
</html>
ベース ファイルは "testDialog.xhtml" という名前で、"/Test" フォルダーにあり、以下が含まれています。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Test Dialog</title>
<meta name="viewport" content="width=device-width"/>
</h:head>
<h:body>
<h:form>
<p:commandButton value="View Cars" actionListener="#{hostBean.view}" />
</h:form>
</h:body>
</html>
最後に、バッキング Bean には以下が含まれます。
@ManagedBean
@SessionScoped
public class HostBean implements Serializable {
public void view() {
RequestContext.getCurrentInstance().openDialog("/Test/dialog");
}
}
デバッグすると、ビューが呼び出されますが、ダイアログは開かれません。(faces-context に 3 行を追加しました。)
何か案は?