• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 22781
131
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic