2013-10-08 85 views
0

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

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(); 

    } 
} 
+0

的可能重复[GWT:获取服务器端的常量(http://stackoverflow.com/questions/12714278/gwt-get-constants-in-server -侧) – slugmandrew

回答

0

Constants是GWT的客户端软件包的一部分,意在GWT UI端使用。对于这个接口,GWT.create(ServerConstants.class)将负责创建对象。

但您要求爱马仕为GWT界面创建对象,即在服务器端创建对象。

我希望你既可以在这种情况下,不能混用