Hi,
First of all. Change the set/getPropetry to set/getProperty.
Then you'll get an error page saying no information can be found about the
property *.
Now,
<%@ page import = "testing.TestBean" %>
<html>
<head></head>
<jsp:useBean id="TestData" class="testing.TestBean" />
<jsp:setProperty name="TestData" property="firstName" value="Dennis"/>
<jsp:getProperty name="TestData" property="firstName" />
<body>
FirstName is: <jsp:getProperty name="TestData" property="firstName" />
</body>
</html>
This will work.
Greetz
Denniz
-----Original Message-----
From: Chris Andreou [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 30, 2001 2:29 AM
To: '[EMAIL PROTECTED]'
Subject: How to use a Bean
I am using JDK1.3 Tomcat 3.3 on Windows Nt platform. The problem I have is
tomcat does not load the bean. It does load Java Api classes. I have the
following bean:
package testing;
import java.io.*;
public class TestBean implements Serializable {
private String FirstName = null;
public TestBean() {}
// Public Accesssors
public void setfirstName(String str) {
FirstName = str;
}
// get Public Accessors
public String getfirstName() {return FirstName;}
}// end of the class
and I am trying to access the property firstName through the string. I
copied the package testing.TestBean unde WEB-INF directory of my context. I
don't get an ClassNotFound error, but the value from the bean does not
display either.
The simple code I an using is :
<%@ page language ="java" contentType="text/html;charset=WINDOWS-1252"%>
<html>
<head></head>
<jsp:useBean id="TestData" class="testing.TestBean" />
<jsp:setPropetry name="TestData" property="*" />
<jsp:getPropetry name="TestData" property="*" />
<body>
FirstName is: <jsp:getProperty name="TestData" property="firstName" />
</body>
</html>
Please, any help would be appreciated!
Thanks in advance
Chris