I’m trying to do a simple static login with google app engine and android app like this:
Server:
public class StreetMeetSignServlet extends HttpServlet
{
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
{
PrintWriter out = response.getWriter();
String userName,password;
userName = request.getParameter("username");
password = request.getParameter("password");
if(userName.equalsIgnoreCase("A") && password.equals("B"))
{
out.print("yes");
}
else
{
out.print("no");
}
}
}
Client Code:
response = CustomHttpClient.executeHttpPost("http://myserver.appspot.com/", postParameters);
String res=response.toString();
System.out.println("res is: " + res);
res= res.replaceAll("\\s+","");
if(res.equals("yes"))
error.setText("Correct Username or Password");
else
error.setText("Sorry!! Incorrect Username or Password");
But in the res string i have the all html code genreated on my jsp..
Why is that?
There is a tutorial from A to Z that show how to connect android app to google app engine servlet?
In your
executeHttpPostmethod you should pass the full path to your servlet, e.g.Did you register your servlet in
web.xml? What is the path?