首先,我们需要定义一个数据源作为数据bean。在这个例子中,我们使用Person类来存储一个人的信息,例如 first name 和 last name。
Person.java public class Person { private String _firstName=""; private String _lastName=""; //getter and setters public void setFirstName(String firstName) { _firstName = firstName; } public String getFirstName() { return _firstName; } public void setLastName(String lastName) { _lastName = lastName; } public String getLastName() { return _lastName; } public void setFullName(String f) { //do nothing. } public String getFullName() { return _firstName + " " + _lastName; } }
然后在页面内声明一个数据源,如下,
<zscript> //prepare the example person object Person person = new Person(); person.setFirstName("Tom"); person.setLastName("Hanks"); </zscript>