1

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>

「OK」をクリックして 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");
}

 }

omn​​ifaces.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>

4

1 に答える 1

1

BalusC がコメントで指摘したように、整数コンバーターと関係があります。次のダミーの整数コンバーターがありましたが、プロジェクトのどこかに隠されていました。

@FacesConverter(value = "someDummyConverter")
public class SomeDummyConverter extends IntegerConverter {
public Object getAsObject(FacesContext context, UIComponent component,
        String value) {
    Integer intValue = (Integer) super.getAsObject(context, component, value);
    return intValue;
}

@Override
public String getAsString(FacesContext context, UIComponent component, Object o) {
    return null;
}

}

OmniFaces 1.5 または 1.6 を使用した場合、このコンバーターは呼び出されませんでした。OmniFaces 1.6.1、1.6.2、1.6.3 では、コンバーターが呼び出されました。コンバーターを削除すると、問題はなくなりました。

于 2013-10-29T13:49:21.090 に答える