Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android 2 Application Development
This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 18th, 2011, 05:05 PM
Registered User
 
Join Date: Apr 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default android and internet

Hi guys!

I'm making an app that must login on the server to run...

Here's the app code:

Code:
DefaultHttpClient httpclient = new DefaultHttpClient();
	    			HttpPost httppost = new HttpPost("http://192.168.1.103:8080/Teste");
	    			
	    			
	    			List<NameValuePair> postParameters = new ArrayList<NameValuePair>(2);
	    			postParameters.add(new BasicNameValuePair("login", "daniel"));
	    			postParameters.add(new BasicNameValuePair("senha", "1234"));
	    			
	    			httppost.setEntity(new UrlEncodedFormEntity(postParameters));
	    			
	    			HttpResponse response = httpclient.execute(httppost);
	    			
	    			HttpEntity resEntity = response.getEntity();
	    			
	    			Log.d("DEBUG", response.getStatusLine().getStatusCode()+"");

With this, my app can connect to the server. See the code on server:

Code:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    //Pega os parâmetros da página
    String login, senha;
    login = request.getParameter("login");
    senha = request.getParameter("senha");

    System.out.println(login);
    System.out.println(senha);
    
    if(login!=null && !"".equals(login) && senha!= null && !"".equals(senha))
    {
        response.sendRedirect("login.jsp");
    }
    else
        response.sendError(response.SC_BAD_REQUEST);
%>
Here's the problem.... the paremeters are always "null". Why? What I'm doing wrong?
Any help will be great!
Thank you all!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cryptography and Android jhwong56 BOOK: Beginning Cryptography with Java 2 April 12th, 2011 09:10 PM
Android SDK/Android.bat does not find SWT.jar file chaoticandroid BOOK: Professional Android 2 Application Development 1 March 23rd, 2011 06:39 PM
Upgrade to Android 2.3 MellowFellow BOOK: Professional Android 2 Application Development 0 January 19th, 2011 02:19 PM
i am new to android janardhan BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 2 July 29th, 2010 03:37 PM
Internet Explorer cannot open the internet site cathiec ASP.NET 2.0 Basics 1 October 22nd, 2005 01:30 PM



All times are GMT -4. The time now is 10:03 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.