0

我正在尝试使用 Hermes 在 GWT 中实现服务器端常量。我正在使用 Hermes 1.2 和 GWT 2.5。我已将 Hermes 添加到我的构建路径并导入到我的 WEB-IF\lib 中。我的服务器包中有一个 ServerConstants.java 文件和 ServerConstants.properties 文件,但是当我去创建一个常量对象时

ServerConstants constants = Hermes.get(ServerConstants.class, "en");

我得到这个错误。

Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor

我无法在 ServerConstants.java 中创建构造函数,因为它是一个接口,那么我在这个谜题中到底缺少什么?如果这里重要的是我的 ServerConstants.java 文件

package com.cbs.ioma.server;

import com.google.gwt.i18n.client.Constants;

public interface ServerConstants extends Constants {

    String test();

    }
}
4

1 回答 1

0

常量是 GWT 客户端包的一部分,它打算在 GWT UI 端使用。对于这个接口,GWT.create(ServerConstants.class) 将负责创建对象。

但是您要求 Hermes 为 GWT 接口创建对象,即在服务器端。

我希望你不能在这种情况下混合使用

于 2013-10-08T22:14:39.610 回答