Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor edits

...

When you refresh the page, you'll see the following:

Tapestry 's has done quite a bit of work here. It has created a form that includes a field for each property. Further, its it has seen that the honorific property is an enumerated type, and presented that as a drop-down list.

...

The BeanEditForm must guess at the right order to present the fields; for public fields, they end up in alphabetical order

Wiki Markup
{footnote}For standard JavaBeans properties, the BeanEditForm default is in the order in which the getter methods are defined in the class (it uses line number information, if available).{footnote}

.

 

A better order for these fields is the order in which they are defined in the Address class:

...

In Tapestry, when binding a parameter, the value you provide may include a prefix. The prefix guides Tapestry in how to interpret the rest of the the parameter value ... is it the name of a property? The id of a component? A message key? Most fields parameters have a default prefix, usually "prop:", that is used when you fail to provide one (this helps to make the templates as terse as possible).

...

Code Block
languagexml
  <t:beaneditform object="address" submitlabel="message:submit-label"
    reorder="honorific,firstName,lastName,street1,street2,city,state,zip,email,phone" />

And then we define the submit-label key in the message catalog:

No Format
submit-label=Create Address

At then the end of the day, the exact same HTML is sent to the client, regardless of whether you include the label text directly in the template, or indirectly in the message catalog. In the long term, the latter approach will work better if you later chose to internationalize your application.

...