简体   繁体   English

如何将表格数据上传到Google App Engine

[英]How to upload form data to google app engine

To upload data to the datastore I use this java code : 要将数据上传到数据存储区,请使用以下Java代码:

DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
Entity entity = new Entity("mydetail");
entity.setProperty("entry", "entry");
ds.put(entity);

For uploading form based data is this the correct method of uploading data, ie using similar code above or is there another API I should be using ? 对于上传基于表单的数据,这是否是上传数据的正确方法,即使用上面类似的代码,还是我应该使用另一个API?

Yes, this the direct API to the AppEngine Datastore. 是的,这是AppEngine数据存储区的直接API。

You can also use JDO interface which allows for directly storing a Java object without dealing with the Datastore API: 您还可以使用JDO接口,该接口允许直接存储Java对象,而无需处理Datastore API:

import javax.jdo.annotations.Persistent;

@PersistenceCapable
public class MyDetail {
    // ...
    @Persistent
    private String entry;
    // ...

There is also the JPA interface. 还有JPA接口。 Both of the interfaces are described on the App Engine website. 这两个界面均在App Engine网站上进行了说明。

The Objectify interface is very easy and for many situations easier. Objectify接口非常简单,并且在许多情况下更容易实现。 It is not part of the official SDK. 它不是官方SDK的一部分。

You can use whichever makes more sense for you application. 您可以使用对您的应用程序更有意义的任何一种。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM