Which of these is more correct when using Struts2 freemarker tag dynamic
attributes for @s.url:
<@s.url action="viewitem" itemid="${item.itemid?c}" />
or
<@s.url action="viewitem" itemid=item.itemid />
I've been favoring the second example, since it doesn't require me to remember
to do "?c" for my integer arguments, and appears to properly exclude parameters
that have null values from the resulting URL.
This is common enough that I believe the "Attribute Types" section of the
freemarker tags document should include an example for an integer. It could
mention that you might prefer to pass the freemarker variable instead of
passing the argument as a string, where you'll be required to remember to use
"?c" for numbers to avoid a comma being passed resulting in
ognl.MethodFailException for the integer-only setter.
http://struts.apache.org/2.2.3/docs/freemarker-tags.html
Or maybe it's "obvious."
-rgm