Sample code for el access java bean

From Documentation
Revision as of 03:09, 23 July 2010 by Char (talk | contribs) (Created page with ' {{ZKDevelopersGuidePageHeader}} In the following example, you can see how EL can access property of java bean. The zul, <source lang="xml" > <window> <zscript> Person perso…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Documentationample code for el access java bean
ample code for el access java bean


Stop.png This documentation is for an older version of ZK. For the latest one, please click here.


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;
	}
}



Last Update : 2010/07/23

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