Can somebody tell me why the following code is throws an exception when I try
to compile it (code is from J. Hunter's Java Servlet Programming) :

<HTML>
<HEAD><TITLE>Hello1</TITLE></HEAD>
<BODY>
<H1>
Hello, <%= getName(request) %>
</H1>
</BODY>
</HTML>

<SCRIPT RUNAT="server">
private static final String DEFAULT_NAME = "World";

private String getName(HttpServletRequest req) {
  String name = req.getParameter("name");
  if (name == null)
    return DEFAULT_NAME;
  else
    return name;
}
</SCRIPT>


And here's the exception :
Hello1$jsp.java [61:1] cannot resolve symbol
symbol  : method getName  (javax.servlet.http.HttpServletRequest)
location: class org.apache.jsp.Hello1$jsp
                out.print( getName(request) );
                           ^
1 error
Errors compiling Hello1.


Any help will be much appreciated.

Bob.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to