Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Use complex OGNL expressions - the framework will automatically take care of creating the actual objects for you.
  • Use JavaBeans! The framework can only create objects if the objects obey the JavaBean specification and provide no-arg constructions, as well as getters and setters where appropriate.
  • Remember that person.name will call getPerson().setName(), but if in order for the framework to create the Person object for you, a setPerson must also exist.
  • Wiki Markup
    For lists and maps, use index notation, such as _people\[WW:0\].name_ or _friends\[WW:'patrick'\].name_. Often these HTML form elements are being rendered inside a loop. For [WW:JSP Tags], use the iterator tag's status attribute. For [WW:FreeMarker Tags], use the special property $\{foo_index\}\[\].
  • For multiple select boxes, it isn't possible to use index notation to name each individual item. Instead, name your element people.name and the framework will understand that it should create a new Person object for each selected item and set its name accordingly.

...

Wiki Markup
Unlike Map and List element properties, if {{fooCollection(22)}} does not exist, it will not be created. If you would like it created, use the notation {{fooCollection.makeNew\[WW:index\]}} where _index_ is an integer 0, 1, and so on. Thus, parameter value pairs {{fooCollection.makeNew\[WW:0\]=Phil}} and {{fooCollection.makeNew\[WW:1\]=John}} would add two new Foo Objects to {{fooCollection \-\-}} one with name property value {{Phil}} and the other with name property value {{Bar}}. However, in the case of a Set, the {{equals}} and {{hashCode}} methods should be defined such that they don't only include the {{id}} property. Otherwise, one element of the null {{id}} properties Foos to be removed from the Set.

...

There are two ways the error reporting can occur:

  1. Globally, using the Conversion Error Interceptor
  2. On a per-field basis, using the conversion validator

By default, the conversion interceptor is included in struts-default.xml in the default stack. To keep conversion errors from reporting globally, change the interceptor stack, and add additional validation rules.

Next: Validation