Versions Compared

Key

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

...

Code Block
java
java
ActionContext.getContext().getSession().put("mySessionPropKey", mySessionObject);
Code Block
xml
xml
<ww: property value="#session.mySessionPropKey"/> or
<ww: property value="#session['mySessionPropKey']"/> or
<ww: property value="#attr.mySessionPropKey"/>

...

Dealing with collections(maps, lists, and sets) in webwork comes often, so here are a few examples using the select tag:
Syntax for list: {e1,e2,e3}. This creates a List containing the String "name1", "name2" and "name3". It also selects "name2" as the default value. Notice the use of the Alt Syntax to provide the literal "name2".

Code Block
xml
xml
<webwork<ww:select label="label" name="name" list="{'name1','name2','name3'}" value="%{'name2'}" />

Syntax for map: #{key1:value1,key2:value2}. This creates a map that maps the string "foo" to the string "foovalue" and "bar" to the string "barvalue":

Code Block
xml
xml
<webwork<ww:select label="label" name="name" list="#{'foo':'foovalue', 'bar':'barvalue'}" />

You may need to determine if an element exists in a collection. You can accomplish this with the operations in and not in

Code Block
xml
xml
<ui<ww:if test="'foo' in {'foo','bar'}">
   muhahaha
</uiww:if>
<ui<ww:else>
   boo
</uiww:else>

<ui<ww:if test="'foo' not in {'foo','bar'}">
   muhahaha
</uiww:if>
<ui<ww:else>
   boo
</uiww:else>

To select a subset of a collection (called projection), you can use a wildcard within the collection.

...