gpt4 book ai didi

jsf - 警告 : @FacesConverter is using both value and forClass, 仅应用值

转载 作者:行者123 更新时间:2023-12-02 04:50:11 27 4
gpt4 key购买 nike

我安装了 OmniFaces 1.6,并创建了带注释的类 @FacesConverter(forClass=MyClass.class)

在 GlassFish 中的项目部署过程中,我有几个问题:

INFO: Initialisation de Mojarra 2.2.2 ( 20130809-1625 https://svn.java.net/svn/mojarra~svn/tags/2.2.2@12376) pour le contexte «/ErpCCFWEB»
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
INFO: Running on PrimeFaces 4.0.RC1

我有 3 个带注释的类,其中之一如下:

@FacesConverter(forClass = Commune.class)
public class CommuneConverter implements Converter {

private static final Logger LOG = Logger.getLogger(CommuneConverter.class.getName());
@EJB
private ReferentielDaoLocal myService;
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (value == null) {
return null;
} else {
try {
// ReferentielDaoLocal myService = (ReferentielDaoLocal) new InitialContext().lookup("java:global/ErpCCF/ErpCCF-ejb/ReferentielDaoImpl");
return myService.findCommuneByCode(value);
} catch (Exception ex) {
LOG.log(Level.SEVERE, "Converter Commune Error", ex.getMessage());
return null;
}

}
}

@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value == null) {
return null;
} else {
return String.valueOf(((Commune) value).getIdCommune());
}
}
}

最佳答案

根据 this :

Warnings are specific to Mojarra and completely unrelated to OmniFaces. This is fixed in Mojarra 2.1.26: https://java.net/jira/browse/JAVASERVERFACES-2987

跟踪器还包括 2.2.3 作为修复版本,因此您可以尝试一下。

关于jsf - 警告 : @FacesConverter is using both value and forClass, 仅应用值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19000914/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com