That depends on what you mean by "call". A servlet will run in a different JVM than the Swing app, so it's not just a plain old method call. What you can do is make an HTTP request to a URL that's handled by the servlet, and receive its response. Here's an example of how to do that; note that it's possible to pass parameters in the URL if you need to (of course, you need to do proper exception handling as well). [ July 26, 2008: Message edited by: Ulf Dittmer ]
Originally posted by sunanda kadam: I want to ceeate one swing component & on action event of that component , servlet needs to be invoked. just as INBOX button in any mail site . please guide me for this .
Just to follow up on what other people are saying - A Servlet runs on a Server, and Swing runs on a Client. They are, for all intents and purposes different Machines (even if on the same computer, they are on different Java Virtual Machines) so they can't directly talk.
What you can do is make an HTTP Request from the Swing Client to the Server's Servlet and read the response from the Server. This is the only way to communicate with the Servlet.
Read that link to learn the details of how to do said HTTP Request.