This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes --Sockets in Servlets/JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "--Sockets in Servlets/JSP" Watch "--Sockets in Servlets/JSP" New topic
Author

--Sockets in Servlets/JSP

Thomas Dev
Greenhorn

Joined: Dec 15, 2003
Posts: 4
Can we do Socket Programming in Servlets or JSP?
OR can we call a class from Servlets/JSP that does
socket connection.
I have a class that does a socket connection and then
closes the socket when processing is done.
When I try to instantiate this class from JSP I get a
IllegalStateException: Response has already been commited
error.
Why am I getting this error? I havent even called any method
I get this error just by instantiating the class.
If I comment the socket part from the class then it works fine.
regards
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Thomas Dev:
Can we do Socket Programming in Servlets or JSP?
OR can we call a class from Servlets/JSP that does
socket connection.
I have a class that does a socket connection and then
closes the socket when processing is done.
When I try to instantiate this class from JSP I get a
IllegalStateException: Response has already been commited
error.
Why am I getting this error? I havent even called any method
I get this error just by instantiating the class.
If I comment the socket part from the class then it works fine.
regards

Try to do the same in Servlet.
In jsp you dont know when its sending response. Try to see generated java file.


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
 
GeeCON Prague 2014
 
subject: --Sockets in Servlets/JSP