I'm making an app that must login on the server to run...
Here's the app code:
With this, my app can connect to the server. See the code on server:
Here's the problem.... the paremeters are always "null". Why? What I'm doing wrong?
Any help will be great!
Thank you all!
Hardik Trivedi
Ranch Hand
Joined: Jan 30, 2010
Posts: 252
posted
0
Hi Daniel,
Once I have treid this stuff in Android. I found that code and pasting some code snippet. I hope it will be helpful to you.
Code in Android:
Where convert is a mehod which converts InputStream to String. I have intentionally not posted code for it.But google can help you out.
And below is my jsp file :
And I will suggest you to check port number and IP address once. And to generate response use Servlets. MVC-2 is the great concept use it man.
Tell me if you still need a help.
Daniel Lima
Greenhorn
Joined: Feb 12, 2010
Posts: 13
posted
0
Hey Hardik, thank you very much!
It works!!!
Your code works perfectly!
But I have a doubt... You see a security problem by passing user and password in the url?
Thanks man!
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32769
posted
0
You see a security problem by passing user and password in the url?
Yes, it is. URLs are part of the access logs kept by HTTP servers, leaving them at the mercy of anyone who has (legitimately or illegitimately) access to them. They're also kept in web browser, web server and proxy caches, making this a not-so-good approach.
I'm not exactly sure, but the way of adding parameters looks kind of complicated. Have you tried something like this?
Hardik Trivedi
Ranch Hand
Joined: Jan 30, 2010
Posts: 252
posted
1
Hi Daniel and Ulf,
I know that is a security glitch.
I have solution too.
Ulf your previous code is I think almost right. There must be some other issue. I am sending a new code which I have just tried And it is working for me.
Android Code :
Hi, i am trying a lot with Android and Jsp using the example here. But JSP file is not able to get the value (which is set in NameValuePair in Android Activity) in request.getParamater. For me, the returned username and Password always null , unless i ran the JSP file by giving by name and password as
http://localhost:8080/TestJsp/login.jsp?userName=Naba,&password=Goswami