florida
02-05-2005, 11:53 AM
I am trying to create my first bean on my Windows XP. I loaded Tomcat 4.0 and can pull up JSP the Tomcat examples that came with the Tomcat software, but cant get my first bean to work!
Here is where I put my Bean file (called TheFirstBean.java) and compiled it in this location in a package name called num:
C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\num
The TheFirstBean.java:
package num;
import java.util.*;
public class TheFirstBean
{
private String message = "Hello World";
public String getMes()
{
return (message);
}
public void setMes(String message)
{
this.message = message;
}
}
The JSP is located in this path:
C:\Program Files\Apache Tomcat 4.0\webapps\examples\jsp\num
<html>
<head>
<title>Untitled</title>
</head>
<body>
<jsp:useBean id="myID" class="num.TheFirstBean" />
<jsp:getProperty name="myID" property="message" />
</body>
</html>
After I pull up the page (http://localhost:8080/examples/jsp/num/tester.jsp), it gives me error message:
org.apache.jasper.JasperException: Cannot find any information on property 'message' in a bean of type 'num.TheFirstBean'
I cant seem to get any of my Bean to work. But the Tomcat examples that came with Tomcat work fine!
Please advise how I can get my first bean to work because I have tried many many hours.
Thanks
Here is where I put my Bean file (called TheFirstBean.java) and compiled it in this location in a package name called num:
C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\num
The TheFirstBean.java:
package num;
import java.util.*;
public class TheFirstBean
{
private String message = "Hello World";
public String getMes()
{
return (message);
}
public void setMes(String message)
{
this.message = message;
}
}
The JSP is located in this path:
C:\Program Files\Apache Tomcat 4.0\webapps\examples\jsp\num
<html>
<head>
<title>Untitled</title>
</head>
<body>
<jsp:useBean id="myID" class="num.TheFirstBean" />
<jsp:getProperty name="myID" property="message" />
</body>
</html>
After I pull up the page (http://localhost:8080/examples/jsp/num/tester.jsp), it gives me error message:
org.apache.jasper.JasperException: Cannot find any information on property 'message' in a bean of type 'num.TheFirstBean'
I cant seem to get any of my Bean to work. But the Tomcat examples that came with Tomcat work fine!
Please advise how I can get my first bean to work because I have tried many many hours.
Thanks