Hi:
I am reading Hunter's book and try to using the samples from the book. I
have the following problems:
1) When I use server side declaration sample as following and saved as jsp
file
<html>
<head>
<title>Hello</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 put this file in the public_html directory of Java Web Server and run it, I
got the following message:
Error getting compiled page
D:\JAVAWE~1.0\bin\..\tmpdir\default\pagecompile\jsp\_hello2.java:32: Method
getName(javax.servlet.http.HttpServletRequest) not found in class
pagecompile.jsp._hello2.
out.println(getName(request));
^
1 error
2)Using <BEAN>: this is the jsp file:
<%@ import = "HelloBean" %>
<BEAN NAME="hello" CLASS="HelloBean" INTROSPECT="yes" CREATE="yes"
SCOPE="request">
</BEAN>
<HTML>
<HEAD><TITLE>Hello</TITLE></HEAD>
<BODY>
<h1>
Hello, <%= hello.getName() %>
</h1>
</BODY>
</HTML>
and this is the java file I compile and saved in classes directory of web
server as the book said.
public class HelloBean{
private String name = "World";
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
}
and message I got is:
Error getting compiled page
com.sun.server.http.pagecompile.jsp.compiler.ParseException:
D:\JavaWebServer2.0\public_html\hellobean.jsp(0, 4) Invalid directive.
Is there anyone has ideas.
Thanks in advance.
you sheng
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html