title: jsp getServletContext() error
body: <p><strong>html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;title&gt;Murach's Java Servlets and JSP&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;%-- import packages and classes needed by the scripts --%&gt;
      &lt;%@ page import="business.*, data.*" %&gt;
  
      &lt;%
          //get parameters from the request
          String firstName = request.getParameter("firstName");
          String lastName = request.getParameter("lastName");
          String emailAddress = request.getParameter("emailAddress");
  
          // get the real path for the EmailList.txt file
          ServletContext sc = this.getServletContext();
          String path = sc.getRealPath("/WEB-INF/EmailList.txt");
  
          // use regular Java objects
          User user = new User(firstName, lastName, emailAddress);
          UserIO.add(user, path);
      %&gt;
      &lt;h1&gt;Thanks for joining our email list&lt;/h1&gt;
      &lt;p&gt;Here is the information that you entered: &lt;/p&gt;
      &lt;table cellspacing="5" cellpadding="5" border="1"&gt;
          &lt;tr&gt;
              &lt;td align="right"&gt;First name:&lt;/td&gt;
              &lt;td&gt;&lt;%= firstName %&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td align="right"&gt;Last name:&lt;/td&gt;
              &lt;td&gt;&lt;%= lastName %&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td align="right"&gt;Email Address:&lt;/td&gt;
              &lt;td&gt;&lt;%= emailAddress %&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  
      &lt;p&gt;To enter another email address, click on the Back &lt;br /&gt;
      button in your browser or the Return button shown &lt;br /&gt;
      below.&lt;/p&gt;
  
      &lt;form action="index.jsp" method="post"&gt;
          &lt;input type="submit" value="Return" /&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and it's giving me this error page...</p>
  
  <blockquote>
    <p><strong>Compilation of 'C:\bea\user_projects\domains\mydomain.\myserver.wlnotdelete\extract\myserver_sample01_WebContent\jsp_servlet__display_email_entry.java'
    <br> failed:</strong>
    C:\bea\user_projects\domains\mydomain.\myserver.wlnotdelete\extract\myserver_sample01_WebContent\jsp_servlet__display_email_entry.java:140:
    cannot resolve symbol<br> probably
    occurred due to an error in
    /display_email_entry.jsp line 19:<br>
    ServletContext sc =
    this.getServletContext();</p>
    
    <p><strong>Full compiler error(s):</strong> C:\bea\user_projects\domains\mydomain.\myserver.wlnotdelete\extract\myserver_sample01_WebContent\jsp_servlet__display_email_entry.java:140:
    cannot resolve symbol<br> symbol  : method
    getServletContext () <br>location: class
    jsp_servlet.__display_email_entry<br>
    &nbsp;&nbsp;&nbsp;&nbsp;ServletContext sc = this.getServletContext(); //[
    /display_email_entry.jsp; Line:19] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^
                               <br><br>1 error <br>Thu Jun 03 15:56:09 CST 2010<br></p>
  </blockquote>
  
  <p>any hint? I'm really new to JSP, and this is my first learning practice... can't find it by google.com....</p>
  
  <p>thanks!</p>