What is expansion and how do we use it?
A friend from college is studing web programming using the tapestry framework, and he asked me if could i help him with his homework. 开发者_运维技巧 One of the questions in the homework says:
What is expansion, and how do we use it?
Its the first time hear about it.
Do you have any idea what is that topic about?
I am kind of confused. Is there any OOP principle with that name?
According to this tutorial it's basically string interpolation.
First is the way we display the current date and time: ${currentTime}. This syntax is used to access a property of the page object, a property named currentTime. Tapestry calls this an expansion. The value inside the braces is the name of a standard JavaBeans property supplied by the page. As we'll see in later chapters, this is just the tip of the iceberg for what is possible using expansions.
It's not an OO term - it's part of Tapestry.
From: http://tapestry.apache.org/exploring-the-project.html
Expansions are an easy way of including some dynamic output when rendering the page. By default, an expansion refers to a JavaBeans property of the page:
<p>The current time is: ${currentTime}</p>
In tapestry expansions or often property expressions that are embedded in your template so in order to render the content.
An example:
Welcome, ${userId}!
Where "userId" is a property of the page.
Here is a link to the documentation:
http://tapestry.apache.org/component-templates.html#ComponentTemplates-Expansions
精彩评论