Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

HTTPUrlConnection

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to use HTTPUrlConnetion class to communicate bewtween two servlets like passing the data from one servlet through GET or POST method and have it returned from second servlet. Both servlets are in different web projects! Can someone post the code ?

i have created following code:

WebApp1 have input.jsp as follwos:

and Account servlet

WebApp2 have billing servlet that basically capitalises string and print it:

When i run http://localhost:8080/WebApp1/input.jsp  and send a string(e.g. fdfd) via test box and enters submit button
this url is hit http://localhost:8080/WebApp1/Account?t1=fdfd but it did not capitalise the string and fileNotFoundException comes.

can someone help me? whats wrong
 
Sheriff
Posts: 22649
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're sending a GET but with a body. That's not allowed in HTTP. You should instead just add the value as a query parameter to the URL you're trying to open.

PS: you didn't use the code tags correctly. They should go around the code block, not be placed in front of it; please re-read https://coderanch.com/wiki/659781/Code-Tags.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic