Hi,
Ive been trying for days now to get form data send to GAE datastore.
Ive looked through stackoverflow and some other sites for example..
basically this is what i done:
android side:
public class myapp extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
HttpClient client;
String response="";
try {
client = new DefaultHttpClient();
DefaultHttpClient hc=new DefaultHttpClient();
ResponseHandler <String> res=new BasicResponseHandler();
HttpPost postMethod=new HttpPost("http://
myapp.appspot.com/savename");
List<NameValuePair> nameValuePairs = new
ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("name", "John
Doe"));
postMethod.setEntity(new
UrlEncodedFormEntity(nameValuePairs));
response=hc.execute(postMethod,res);
Log.v("resp", response);
} catch (Exception e) {
e.printStackTrace();
}
setContentView(tv);
}
}
on GAE i have this servlet:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
Date date = new Date();
String name =req.getParameter("name");
dem.addName(Name,date);
}
When I run the android app and check GAE datastore, the value i set on
android client does not get stored into the database... can someone
help?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en