• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Android and JSP

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys!

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!
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Rancher
Posts: 43076
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ulf!!!

Can you help me to solve this problem?

Thanks again!
 
Ulf Dittmer
Rancher
Posts: 43076
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 252
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :



JSP Code :



Hope this will solve your security problem too.
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yesssssssssssss!!!

Perfect!!!

Thank you very much Hardik Trivedi! It works fine!
Thanks, thanks, thanks, thanks!

Ulf, thank you very much too!
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
kanakaraj chidhambarasamy,
Your post was moved to a new topic.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic