File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes multiple connections with URLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "multiple connections with URLConnection" Watch "multiple connections with URLConnection" New topic

multiple connections with URLConnection

Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
I am trying to make multiple connections using URLConnection class.I have 2 servlets with which i get connected thru my Java application.I am able to connect to the first servlet correctly and i can send and receive data.Now depending on some checking i send the data retreived from my first servlet to the second servlet.So agin i make connection to the secons servlet URL.But i am facing the problems here. I cannot connect to second servlet in the tomcat server i see null value has been received.
This second servlet is not getting invoked.
Any Comments!!!

Also please tell me is it possible to make multiple connection using URLConnecton class or u can make only one connection???

Thanks in advance,
ersin eser
Ranch Hand

Joined: Feb 22, 2001
Posts: 1072
why don't you use getServletContext().getRequestDispatcher(address).forward(request,response) or include(request,response)
it is easier.
Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
Hello Eser,
I am processing the data in my java application and after that i am invoking the second servlet which is used to populate my bean.So that it becomes easy for me to retreive the value in jsp.
Can u tell where and how do i use getServletContext().getRequestDispatcher(address).forward(request,response) or include(request,response).
I agree. Here's the link:
subject: multiple connections with URLConnection
It's not a secret anymore!