2

OmniFaces 1.6 をインストールし、注釈付きのクラスを作成しました@FacesConverter(forClass=MyClass.class)

GlassFish でのプロジェクトの展開中に、いくつかの wearigs があります。

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 つの注釈付きクラスを持っています。そのうちの 1 つは次のとおりです。

@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());
        }
    }
}
4

1 に答える 1

5

これによると:

警告は Mojarra に固有のものであり、OmniFaces とはまったく関係ありません。これは Mojarra 2.1.26 で修正されています: https://java.net/jira/browse/JAVASERVERFACES-2987

トラッカーには修正バージョンとして 2.2.3 も含まれているので、試してみてください。

于 2013-09-25T09:23:13.033 に答える