What specifically isn't working? What line of JavaScript are you expecting to alert that isn't? Did you look in the JavaScript console in the browser yet? Were there any errors?
Also, note that users can turn off JavaScript in the browser. You really should add validation on the
Java side as well.