我正在尝试创建一个GWT应用程序 - 它有一个HTML文件(main.html),java类是main.java.
在Eclipse中,我右键单击 - > GWT - > Module并正确定义了新模块.
但是在添加一些代码之后,当我尝试在开发模式下运行应用程序时,我收到错误
"Could Not find any host pages in project <project-name> "
Run Code Online (Sandbox Code Playgroud)
我只是向main.java添加了一些代码,然后将其保存并尝试在开发模式下运行应用程序......我在这里做错了什么?这里有什么我想念的吗?
我正在尝试使用Eclipse Indigo和Eclipse 插件(GPE),但是找不到GPE 3.7.我的意思是,我会对GPE 3.6感到满意.
现在我在安装GPE3.6时出现此错误:
无法完成安装,因为找不到一个或多个必需的项目.正在安装的软件:适用于Eclipse 3.6的Google插件2.2.0.v201102111811(com.google.gdt.eclipse.suite.e36.feature.feature.group 2.2.0.v201102111811)缺少要求:Eclipse插件适用于Eclipse 3.6 2.2.0. v201102111811(com.google.gdt.eclipse.suite.e36.feature.feature.group 2.2.0.v201102111811)需要' org.eclipse.platform.feature.group [3.6.0,3.7.0) '但它不能被发现
什么是org.eclipse.platform.feature.group?我必须安装什么样的包裹?
我是RequestFactory的新手,但在Thomas Broyer的慷慨帮助下,在审阅了下面的文档后,它变得更好:)
但是,请你解释为什么Locator<>.find()经常被不必要地(在我看来)被召唤?
在我的示例项目中,我有两个维护父子关系的实体Organization和Person.当我获取组织Objectify时自动获取子Person.我还在服务层中创建了两个方法findOrganizationById,saveOrganization即加载和持久化对象.
现在考虑两种情况:
当我findOrganizationById在客户端呼叫后,在服务器端发生呼叫:
OrderDao.findOrganizationById(1)
PojoLocator.getId(Key<?>(Organization(1)))
PojoLocator.getId(Key<?>(Organization(1)/Person(2)))
PojoLocator.getId(Key<?>(Organization(1)))
PojoLocator.find(Key<?>(Organization(1)))
PojoLocator.getId(Key<?>(Organization(1)/Person(2)))
PojoLocator.find(Key<?>(Organization(1)/Person(2)))
Run Code Online (Sandbox Code Playgroud)
通过调用OrderDao.findOrganizationById我已经收到完整的对象图.为什么.find除此之外还要打两次电话?数据存储的额外负载花了我钱.当然我会缓存它,但修复它会很好.如何避免这些额外的通话?
当我通过saveOrganization在客户端中调用来保存对象时,会发生类似的事情.以下调用发生在服务器端:
PojoLocator.find(Key<?>(Organization(1)))
PojoLocator.find(Key<?>(Organization(1)/Person(2)))
OrderDao.saveOrganization(1)
PojoLocator.getId(Key<?>(Organization(1)))
PojoLocator.find(Key<?>(Organization(1)))
PojoLocator.getId(Key<?>(Organization(1)/Person(2)))
PojoLocator.find(Key<?>(Organization(1)/Person(2)))
Run Code Online (Sandbox Code Playgroud)
我可以理解在更新之前需要从DataStore中获取两个对象.RequestFactory将增量发送到服务器,因此在持久化之前需要拥有整个对象.自从我一次加载完整的图表后,不再进行第二次调用会很好PojoLocator.find(Key<?>(Organization(1)/Person(2))).在坚持不懈之后,我真的无法理解.find()呼叫的需要.
想法?
我的代理人
@ProxyFor(value = Organization.class, locator = PojoLocator.class)
public interface OrganizationProxy extends EntityProxy
{
public String getName();
public void setName(String name);
public String …Run Code Online (Sandbox Code Playgroud) 如何删除GWT中的ClickHandler事件?我为一个按钮添加了addClickHandler()事件,我想删除ClickHandler Event.I尝试了HandlerRegistration方法但是它无法删除处理程序,这是一个片段:
notification.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
}
});
Run Code Online (Sandbox Code Playgroud)
我想通知删除处理程序!
Note:
Notification is the button instance that calls the handler!
Run Code Online (Sandbox Code Playgroud) 在java代码中我们可以设置id.是否可以在UiBinder中为GWT小部件设置'id'?
如果有可能请给我一个样品.
其实我尝试了以下代码,
<g:Button ui:field="login" debugId="loginButton">
Run Code Online (Sandbox Code Playgroud)
然后我在警报中检查了它.Window.alert("Id: " + login.getElement().getId());
但输出是Id:.
未设置登录按钮的ID
有没有更好的方法来做到这一点?
谁能帮我?
提前谢谢,Gnik
我必须将文件及其属性发送到GWT服务器.
用于发送文件我使用表单面板.
public class BrowseFile extends DialogBox {
// more code
// ..
private FormPanel getFormPanel() {
if (formPanel == null) {
formPanel = new FormPanel();
formPanel.setMethod(FormPanel.METHOD_POST);
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setAction(GWT.getHostPageBaseURL() +"UploadFileServlet");
formPanel.addSubmitHandler(new FormPanel.SubmitHandler(){
public void onSubmit(SubmitEvent event) {
// TODO Auto-generated method stub
setFilename(fileUpload.getFilename());
}
});
}
return formPanel;
}
}
Run Code Online (Sandbox Code Playgroud)
该文件的所有属性都在Hashmap中

有2个对话框Propertybox extends DialogBox和
BrowseFile extends DialogBox
Run Code Online (Sandbox Code Playgroud)
在PropertyBox的构造函数中有BrowseFile
当PropertyBox构造函数
setSize("600px", "670px");
setHTML("Add Document");
setWidget(getVerticalPanel());
browseFile = new BrowseFile();
Run Code Online (Sandbox Code Playgroud)
PropertyBox内的自定义属性取决于所选的类(Class是树Widget)
在服务器端
public class FileUpload extends HttpServlet implements Servlet{
private …Run Code Online (Sandbox Code Playgroud) 我正在使用GWT.FireFox浏览器和Eclipse IDE开发一个项目.
当项目运行并刷新我的浏览器以进行客户端软件包更改时,需要很长时间.也许是6到10秒.
也许是因为项目变大了.如何加快浏览器的刷新过程?
我试图将原始类型"int"的字段绑定到编辑器.我的编辑器扩展了ValueBox<Integer>,因为Java中的泛型只能使用对象类型.
当我编译我的应用程序时,我收到以下错误:
00:00:18,915 [ERROR]在使用getter表达式""唤醒路径"cadastralDivisionCode"时发现意外类型int
更改getter和setter以使用Integer对象,可以解决问题.有没有办法在GWT 2.1编辑器框架中使用原始类型?
你如何从一个地方到另一个地方获得一个物体?
例如,我有一个ContactsView,其中包含Contacts表,以及相应的ContactsActivity/Place类.如果我想编辑联系人,请单击表格行并转到ContactEditorPlace.ContactEditorView如何让联系人进行编辑?
我见过的例子似乎表明没有在Place中传递实际的对象引用,但是它们却传递了传递String或id的麻烦(例如,Expenses示例).除了简单的标记化之外,还有其他原因吗?是否有某种原因引用不应该在某个地方?
如果未在ContactEditorPlace的构造函数中设置对象引用,那么它是如何进入ContactEditorActivity的?这可以通过EventBus来完成,但是这将是一个将单个引用传递给单个活动的样板.
我想说我没有使用RequestFactory.
在smartGWT中,可以向HTML5-canvas添加另一个小部件(似乎使用接口),如本例所示.
现在我想弄清楚,如果在(原始)GWT2.4中这也是可能的.有没有人使用GWT而没有任何其他项目(如smartGWT,gwtExt,extGWT,......)的工作示例?
谢谢你的所有答案.