Application1>> login jsp which sends the userid and password to servlet of webapplication1
i want to send this userid and password to servlet of another webapplication2 so that it can check with the database whether the credentials are right or wrong and thus implement single sign on.
so that when we click on login of webapplication1 and if the credentials are right we don't need to again login to web application 2.
There are many ways to do this. If you're going to be invoking another servlet on a different
application server/webapp you should learn how to encode your URLs or use https.
Better yet, use an under the cover approach such as JMS.
You'll be disappointed to hear this, but if you're a beginner at web apps then you should not be in charge of implementing security. It's way too easy to put insecure systems in place.
servlet1 could use Apache HttpClient to send a http get or post to servlet2 on other server.
servlet1 would then have to interpret the response from servlet2.