• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending parameters from servlets to URL via POST  RSS feed

 
Arnob Dey
Ranch Hand
Posts: 42
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The task is pretty simple. We just need to send some parameter values to a listener port on an URL via POST from the servlet. But for some reasons I can't get it to work. Is there anything I missed or doing it wrong entirely?

 
Ron McLeod
Saloon Keeper
Posts: 1564
222
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that you are sending your HTTP request  before adding your payload, resulting in a message exchange like this:

You should be calling getResponseCode() after setting your payload, which would result in a message exchange like this:

For example, using your code:



 
Arnob Dey
Ranch Hand
Posts: 42
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Ron .... really appreciate it...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!