• Post Reply Bookmark Topic Watch Topic
  • New Topic

communication problem between applet and servlet in one direction

 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,

i have been trying for many hours to communicate applet to servlet only, not vice-versa using object serialization.
i am using appropiate code, that is being used mostly rather i m having a deep look up around it also.
although most of the resources describing a two way communication but i haven't found ever that one way communication is not possible.generally when i use my way then servlet class does not seems to run but when convert it in two way then everything starts working.

any suggession?

thanks
[ November 20, 2007: Message edited by: Nidhi Nagre ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets can only be accessed over HTTP, which is a request/response protocol. So there will be two-way communication, although the response can be empty, and in any case be ignored by the applet.

What is the rationale for only wanting to send data one way?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me you are going to want at least a reply that indicates the data was received properly - otherwise you will have no idea what happened to it. Suppose the servlet is offline for some reason for example.

Reading the response to a HttpURLConnection is not that hard.

Bill
 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mr Ulf wrote:
What is the rationale for only wanting to send data one way?


because after getting post reqest at servlet side i want to redirect it to another jsp page using requestDispatcher() method. since at servlet side one of these two issues(either forwarding request to another jsp or sending back response to objectoutputstream) is allowed. and my requrement is to forwarding request to another jsp page.


Mr William wrote:
Seems to me you are going to want at least a reply that indicates the data was received properly - otherwise you will have no idea what happened to it. Suppose the servlet is offline for some reason for example.


yeah, using one way communication since servlet class seems not to run.
you are again right that it is not hard to take response through HttpURLConnection, but it is not relevant to my requirement.


although i can use directly get method instead of post, since ,however i have data too long hence using this would not so reliable.


any other solution?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not quite clear on the flow - just because a request was forwarded does not mean it can't send a response. It's just that the response will come from the URL being forwarded to, and not the one originally addressed.
 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks again,

definitly i would be out of this hurdle if you kindly put some snippet in your way if my intention cleared to you.

1)send data to servlet via post
2)forward it to another jsp
3)come back to servlet, even to applet from which request was made in accordance with few conditions
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My impression of the problem is that the applet is communicating to a servlet but there is a need to change the browser view to a different JSP. This can not be done with a normal forward or redirect if the request came from the applet because the resulting response will also be consumed directly by the applet and not by the browser window.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!