页面jsf到对话框不起作用 [英] Page jsf into dialog not working
问题描述
我尝试使用Dialog Framework-Basic从primefaces站点中查找示例
I try to folow exemple from primefaces site .using Dialog Framework - Basic
<p:commandButton value="Options" icon="ui-icon-extlink" action="#{dialogBean.viewCarsCustomized}" />
Bean DialogBean
Bean DialogBean
公共类DialogBean {
public class DialogBean {
public String viewCarsCustomized() {
return "dialog:viewCars?modal=true";
}
}
viewCars.xhtml
viewCars.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:dataTable var="car" value="#{tableBean.carsSmall}">
<p:column headerText="Model">
<h:outputText value="#{car.model}" />
</p:column>
<p:column headerText="Year">
<h:outputText value="#{car.year}" />
</p:column>
<p:column headerText="Manufacturer">
<h:outputText value="#{car.manufacturer}" />
</p:column>
<p:column headerText="Color">
<h:outputText value="#{car.color}" />
</p:column>
</p:dataTable>
</h:body>
</html>
这是我在My Bean上的示例. 我这样尝试
this is My exemple on My Bean . I Try like this
public String viewComposant(){
return "dialog:AjoutC?modal=true";
}
它不起作用,我尝试这样做.但是每次都出错
it is not working,I try to do like this .but every time error
导航故障不可能发生 de vue'/pagess/Parsing/ReacgModule.xhtml'倒入动作 '#{parserXls.viewComposant()}' 对话框:/pagess/pagesComposant/AjoutC.jsf?modal = true".
Impossible de trouver un cas de navigation correspondant depuis l'ID de vue '/pagess/Parsing/ReacgModule.xhtml' pour l'action '#{parserXls.viewComposant()}' avec le résultat 'dialog:/pagess/pagesComposant/AjoutC.jsf?modal=true'.
public String viewComposant(){
return "dialog:/pagess/pagesComposant/AjoutC.jsf?modal=true";
}
但是当我喜欢此页面时,页面就会变回原形,但是却不如我所愿
But When I do like this the page returend but not as I like
public String viewComposant(){
return "/pagess/pagesComposant/AjoutC.jsf";
}
推荐答案
3.5版本的primefaces
引入了对话框架" 中的dialog:
导航结果前缀在PrimeFaces 4.0中使用,而在旧版本中则不起作用.
The dialog:
navigation outcome prefix from "Dialog Framework" is introduced in PrimeFaces 4.0 and don't work in older versions.
因此,您有2个选择:
- 升级到PrimeFaces 4.0(注意:它目前仍处于beta版)
- 在JavaScript中使用
dialogWidgetVar.show()
的旧式"方法,在JSF中使用visible="#{someCondition}
的旧式"方法.另请参见 PrimeFaces展示柜中的<p:dialog>
示例.
- Upgrade to PrimeFaces 4.0 (note: it's currently still in beta)
- Use the "old" approach of
dialogWidgetVar.show()
in JavaScript orvisible="#{someCondition}
in JSF. See also the<p:dialog>
examples in PrimeFaces showcase.
更新:根据评论,这是在JS中通过widgetVar
方法使用它的方式:
Update: as per the comment, here's how you could use it with widgetVar
approach in JS:
<p:button value="Open dialog" onclick="w_dialog.show(); return false;" />
<p:dialog widgetVar="w_dialog">
<p>Dialog's content.</p>
<p:dialog>
这是在JSF中使用visible
方法的方法:
And here's how you could use the visible
approach in JSF:
<h:form>
<p:commandButton value="Open dialog" action="#{bean.showDialog}" update=":dialog" />
</h:form>
<p:dialog id="dialog" visible="#{bean.showDialog}">
<p>Dialog's content.</p>
<p:dialog>
使用
private boolean showDialog;
public void showDialog() {
showDialog = true;
}
public boolean isShowDialog() {
return showDialog;
}
如有必要,您可以将<p:dialog>
移到要由<ui:include>
包含的包含文件中.
You can if necessary move <p:dialog>
into an include file which you include by <ui:include>
.
这篇关于页面jsf到对话框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!