我们在weblogic 11g下使用jsf 2.1 + primefaces 6.0 + primefaces-extensions 6.0.0,mojarra 2.1.7。Primefaces 6.0对话框架和框架集
由于嵌套对话框的要求,我们首次使用了primefaces 6.0。
我们使用对话框框架在页面中使用对话框打开对话框时,检测到一个问题。
我们对左边的菜单,并在我们进入这个XHTML页面右侧(从展示拍摄):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<p:commandButton value="View" icon="ui-icon-extlink" actionListener="#{dfView.viewCars}" />
</h:form>
</h:body>
</html>
一旦号码:命令按钮被点击时,DOM检查显示该对话框已创建外身体和html标签,如下图所示的图像上:
如果我们创建具有相同的代码(没有框架)的新.xhtml并单击号码:的commandButton结果如预期,并打开的对话框:
我们一直试图从backingBean添加属性 “appendTo”,但也不是 “体”,也不是 “@body” 也不是 “@(身体)” 的作品:
package test;
import java.util.HashMap;
import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import org.primefaces.context.RequestContext;
import org.primefaces.event.SelectEvent;
@ManagedBean(name = "dfView")
public class DFView {
public void viewCars() {
final Map<String,Object> options = new HashMap<String, Object>();
options.put("resizable", false);
options.put("appendTo", "@(body)");
RequestContext.getCurrentInstance().openDialog("viewCars", options, null);
}
public void viewCarsCustomized() {
final Map<String,Object> options = new HashMap<String, Object>();
options.put("modal", true);
options.put("width", 640);
options.put("height", 340);
options.put("contentWidth", "100%");
options.put("contentHeight", "100%");
options.put("headerElement", "customheader");
RequestContext.getCurrentInstance().openDialog("viewCars", options, null);
}
public void chooseCar() {
RequestContext.getCurrentInstance().openDialog("selectCar");
}
public void onCarChosen(final SelectEvent event) {
final Car car = (Car) event.getObject();
final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Car Selected", "Id:" + car.getId());
FacesContext.getCurrentInstance().addMessage(null, message);
}
public void showMessage() {
final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "What we do in life", "Echoes in eternity.");
RequestContext.getCurrentInstance().showMessageInDialog(message);
}
}
有针对此问题的任何解决方法?
由于提前,
亚历
PS。 Primefaces 5.2中的相同代码适用于框架
感谢@Lisandro,因为我在我的文章中,我们tryed添加appendTo选项地图传给openDialog方法被提及,但它似乎PF对话框架没有按不认识它。 –