He's assuming a lot about his audience. The tutorial is written for people who know Java web app development, at least to some basic level, and have dealt with a little Javascript, perhaps even tried a jquery tutorial or two. I think this is fine, as it means that someone who is familiar with all of that will be able to jump right in and get to the meat of the matter without having to filter out all the stuff they already know. Perhaps a paragraph at the top explaining those assumptions would be a good idea, but I digress...
What jumps out at me as a potential gotcha is that the weather servlet is in the ajaxify package:
V------see?
<servlet-class>ajaxify.WeatherServlet</servlet-class>
so you will need to make sure you specify that package in WeatherServlet.java
, or change it to match what you are doing. Also, no mention is made of including the jquery.js
file in the <head>
of your JSP:
<script type="text/javascript" src="jquery.js" />
Obviously you will need to include code around the form to make it into a complete html page, so you will have a <head>
element into which to put the various <script>
tags. You will also need to complete the WeatherServlet
class as in any other Java web application:
public class WeatherServlet extends HttpServlet
{
...
BTW, I think it's a great tutorial. I am familiar with Servlets and JSP, know the concept behind AJAX, knew of jQuery, and have messed with jQuery for about ten minutes. The tutorial perfectly filled the gaps in my knowledge I had around how all those pieces fit together. I had no idea jQuery could make AJAX so easy to deal with, and this is going to get me to look a lot more seriously into jQuery.