Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed bad links due to copy-paste from cwiki-test

Tapestry uses property expressions to move data between components. Property expressions are the basis of the component parameters and template expansions.

Div
stylefloat:right
titleRelated Articles
classaui-label
Content by Label
showLabelsfalse
showSpacefalse
titleRelated Articles
cqllabel = "expressions" and space = currentSpace()

...

  • Whitespace is ignored.
  • Integers and decimals may have a leading sign ('+' or '-').
  • Constants are in base 10 (octal and hex notation is not yet supported). Decimals may contain a decimal point (exponent notation not yet supported).
  • Literal strings are enclosed in single quotes.
  • The rangeOp creates a range object that will iterate between the two values. The upper and lower bounds may be literal integers, or property expressions.
  • An identifier by itself is a property name. An identifier with parenthesis is a method invocation.
  • Property names, method names, and keywords are case-insensitive.
  • 'this' is the root object (i.e., the containing component).
  • The not operator coerces the expression to a boolean (so it can be used on strings, numbers, etc.).
  • Method matching is based on method name and number of parameters, but not parameter types. The TypeCoercer service is used to convert parameters to the correct type to be passed into the method.

...

 

Example

Notes

Keyword

this

 

Keyword

null

 

Property Name

userName

Calls getUserName() or setUserName, depending on context

Property Chain

user.address.city

Calls getUser().getAddress().getCity() or getUser().getAddress().setCity(), depending on context

Property Chain

user?.name

Calls getUser() and, if the result is not null, calls getName() on the result

Method Invocation

groupList.size()

calls getGroupList().size()

Method Invocation

members.findById(user.id)?.name

Calls getMembers().findById(getUser().getId())?.getName() (unless findById returns null)

Range

1..10

Iterates between integers 1 and 10

Range

1..groupList.size()

Iterates between 1 and the result of getGroupList().size()

Literal String

'Beer is proof that God loves us and wants us to be happy.'

Use single quotes

List

[user.name, user.email, user.phone]

 

Not Operator

! user.deleted

the boolean negation of getUser().getDeleted()

Not, Coerced

! user.middleName

true only if getUser.getMiddleName() returns null or an empty string

Map

{ 'framework' : 'Tapestry', 'version' : version }

Keys are string literals (in single quotes), but could be properties as well