Sample code for el access java bean

From Documentation

Jump to: navigation, search






In the following example, you can see how EL can access property of java bean.

The zul,

<window>
	<zscript>
		Person person = new Person();
		person.setFirstName("Tom");
		person.setLastName("Hanks");
	</zscript>
	First name is :${person.firstName}
	Last name is :${person.lastName}
	Full name is :${person.fullName}
</window>

And the java file, 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;
	}
}




Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.