you haven't mention what exactly you want to achieve.
Java and ajax has nothing in common. Infact ajax stands for "asynchronous javascript and xml" . Java is a complete programming language with capability to program lots of secenarios where as ajax helps to send and retrieve information from webserver without refreshing or submitting the form.
__________________
|