java.net have a good article with code examples showing how to get started with the much talked about Google Web Toolkit, which allows you to build AJAX web applications entirely in Java and then generate the HTML and Javascript for the frontend.
Check out the article here.