title: Javascript to validate form NullpointerException
body: <p>Following this very bad book that's giving me lots of headache but I don't know why I keep reading it.</p>
  
  <p>It's obvious that user.getEmailAddress() is going to be null so it's giving me this error, but removing it doesn't work(i.e. submit not submitting, and any textbox after the first textbox doesn't validate) so I just want to type exactly what the book shows to see how it goes but of course it doesn't compile.
  Could anyone give some suggestion? thanks.</p>
  
  <pre><code>            &lt;tr&gt;
                  &lt;td align="right"&gt;Email address:&lt;/td&gt;
                  &lt;td&gt; &lt;input type="email" name="email"
                              value="&lt;%= user.getEmailAddress() %&gt;"
                              placeholder="Enter a valid email address"&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;br&gt;&lt;input type="button" value="Submit"
                                 onClick="validate(this.form)"&gt;&lt;/td&gt;
              &lt;/tr&gt;
  </code></pre>
  
  <p><a href="http://s1.uploads.im/5v3gY.png" rel="nofollow">http://s1.uploads.im/5v3gY.png</a></p>
  
  <p>Above is a link to the code page in the book. </p>