Primefaces 3.5.16、JBoss 7.2.0、PE 0.7.1、Mojara 2.1.26、WELD-000900 1.1.10(最终版) Web.xml 有一些配置内容,faces-config 定义了语言包。
我有以下对话框,其中包含一些输入字段和 p:tabview:
<p:dialog>
<h:form>
<p:tabView binding="#{tabViewEL}">
<p:messages autoUpdate="true"/>
<p:tab title="tab1">
<p:inputText value="#{bean.value1}" required="true" />
<p:inputText value="#{bean.value2}" />
<p:selectOneMenu value="#{bean.value3}">
<f:selectItems value="#{bean.items1}"></f:selectItems>
</p:selectOneMenu>
</p:tab>
<p:tab> ... </p:tab>
</p:tabView>
<p:commandButton value="ok" oncomplete="checkAndHide(xhr, status, args);" action="#{bean.action()}"/>
</h:form>
</p:dialog>
如果我单击“确定”并且我使用的是 OmniFaces v. 1.5 或 1.6,它可以正常工作。如果我使用的是 1.6.1,则所有必填字段(以及没有 null-selected-Item 的 p:selectOneMenu)都标记为红色,并带有错误“需要值”。如何在没有验证错误的情况下使用 1.6.1?
编辑 :我试图创建一个示例,但我发现了另一个奇怪的应用程序行为。在 OmniFaces 1.6 中,它可以正常工作,但在 1.6.1 中,输入字段没有填充值。
OmnitestBean.java
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class OmnitestBean implements Serializable{
private Integer value1 = 12;
private Integer value2 = 3;
public OmnitestBean (){
System.out.println("Constru");
}
@PostConstruct
public void a(){
value1 = 14;
value2 = 30;
System.out.println("in postconstruct");
}
public Integer getValue1() {
return value1;
}
public void setValue1(Integer value1) {
this.value1 = value1;
}
public Integer getValue2() {
return value2;
}
public void setValue2(Integer value2) {
this.value2 = value2;
}
public void action(){
System.out.println("In action");
}
}
omnifaces.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:head />
<body>
<h:form id="editPopForm">
<p:messages id="messages2" autoUpdate="true"></p:messages>
<p:inputText value="#{omnitestBean.value1}" required="true" />
<p:inputText value="#{omnitestBean.value2}" />
<p:commandButton process="@form" action="#{omnitestBean.action()}" value="OK"
update="@form" id="editFormOkButt" />
</h:form>