Hi.. i m using urlconnection class in one servlet(say connecttoServer.java) to connect another servlet. After fist read and write connection becomes null. Is there any way to connect to same servlet? also plz guide me to know How to connect to another servlet from connecttoServer.java?
thx in advance...
Jaime M. Tovar
Ranch Hand
Joined: Mar 28, 2005
Posts: 133
posted
0
Sorry but why you are trying to connect to another servlet?
She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.
Originally posted by javabeans: Hi.. i m using urlconnection class in one servlet(say connecttoServer.java) to connect another servlet. After fist read and write connection becomes null. Is there any way to connect to same servlet? also plz guide me to know How to connect to another servlet from connecttoServer.java?
thx in advance...
HTTP is a stateless protocol. You make a request, and the server responds. After that, if you want to do more, then you establish another connection.
thx for reply... actually i have one servlet that will take userId an userPassword and sends this info. to remote servlet .I m using urlconnection for this purpose. But aftrer first write and read is done connection is null. I f i want to write more data i m making another new connection with different servlet. But problem is that servlet is not getting executed.
Can you post the code to your servlet or describe the program flow for what you are doing?
Where, in the servlet, are you establishing the URLConnection to the other resource?
aditya seth
Greenhorn
Joined: Nov 01, 2005
Posts: 11
posted
0
Hi ... thx for reply.. program is working now... actually i was trying break the connection establishment function ,write to stream function and reading response function. somewhere it went wrong and i was getting that problem.
The simplest code will be.. import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.net.*;