I am new to ServerSide programming, I want to know like how many ways can u make the servlets communicate to eachother.
if possible pls send me the sample code.
If you are that new, you should read a good servlet book.
Everyone, I opologize for getting off topic here for a moment....
Jeff, I normally don't get into this sort of thing.
However, I've noticed that on at least 2 occasions you've told people to read books in a pretty gruff fashion. Your implication seems to be that they shouldn't be posting these sorts of questions.
Maybe these people could be a little better about self- education. However, maybe you could take the edge off of the gruffness a little. It doesn't hurt anyone for people to come and ask questions. If you don't want to answer, then don't. This is an open community, with people in a wide range of skill levels. Just because the questions are beneath your skills, doesn't mean that they don't bear value in having them asked, answered, and answered well. If one person is asking, maybe others are too. I'm also going to post this is the general forums area, since I've seen a lot of other people make similar comments.
Again, I opologize for being off topic. But I think this is a learning and research environment to all. I'm not trying to get on anyone's case.
boy I sure can't spell apologize.
You are absolutely right.
one servlet can communicate with other servlet in
1.A servlet can forward its request and response objects
to another servlet. In that case the control will be transfered to the distination servlet permenantly.
RequestDispatcher rd=ServletContext.getRequestDispatcher(String url)
2.A servlet can include the output of another servlet
by using include method of RequestDispatcher.
In this case control will be transfered to the destination
servlet temporaly after excuting the dest servlet the o/p
will be included in the first servlet and excution continues
These can be used between the servlets belongs to same webapplication on the same server.
If you want to communicate with servlet of different webapplication on the same server then you can use response.sendRedirect(String url)
If you want to comunicate with servlet running on different web server then you have to use any one of these RMI, Socket programming or using URLConnection object.
Hope it will be useful.
sure i'll try to work on this.
Thanks a lot Rama!!!