Alt Syntax - Apache Struts 2 Wiki - Apache Software Foundation DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account. Log in Linked Applications Loading… Apache Software Foundation Spaces Hit enter to search Help Online Help Keyboard Shortcuts Feed Builder What’s new What’s new About Confluence Log in Apache Struts 2 WikiEdit space details Child pages Pages Alt Syntax Browse pagesConfigureSpace tools Attachments (0) Page History Resolved comments Page Information View in Hierarchy View Source Export to PDF Export to Word Copy Page Tree Pages Jira links Alt Syntax Created by Patrick Lightbody, last updated by Lukasz Lenart on Sep 11, 2012 2 minute read The altSyntax is an option that can be defined in struts.properties. By default it is set to true and it is strongly recommend you do not change that unless you are upgrading from WebWork 2.1.7 or previous versions. Migration tip You can also turn on the altSyntax on a per-page basis by using the set tag. Simply set the name useAltSyntax to the value true. From this point on, all tags will use the altSyntax for the rest of the request. The altSyntax changes the behavior of how tags are interpreted. Instead of evaluating each tag parameter against the value stack and needing single quotes to mark string literals, only marked expressions are evaluated. Example: the following code uses the Tag Syntax: <s:iterator value="cart.items"> ... <s:textfield label="'Cart item No.' + #rowstatus.index + ' note'" name="'cart.items[' + #rowstatus.index + '].note'" value="note" /> </s:iterator> this is somewhat counter intuitive to normal HTML tag behaviour, and you get loads of single quotes. Now the same example in altSyntax: <s:iterator value="cart.items"> ... <s:textfield label="Cart item No. %{#rowstatus.index} note" name="cart.items[%{#rowstatus.index}].note" value="%{note}" /> </s:iterator> Only expressions enclosed with %{} are evaluated. The code is shorter and clearer, very similar to JSTL EL usage. Quoting problems, eg. with javascript function calls, are avoided. In order to fully understand why this option exists and what the differences are, it is best to get a bit of history about WebWork. If you are not upgrading from WebWork 2.1.7 or previous versions and you don't care about the history of WebWork's evolution, you can skip this section. See the Tag Syntax section for more information on the standard tag syntax support History In WebWork 2.1.4, the altSyntax option was introduced. The book, WebWork in Action, while based around WebWork 2.1.7, was entirely written with the assumption that the altSyntax was enabled. As of WebWork 2.2, the altSyntax is turned on by default and eventually the old syntax will no longer be supported and will be removed from the code. No labels Overview Content Tools Powered by a free Atlassian Confluence Open Source Project License granted to Apache Software Foundation. Evaluate Confluence today. Powered by Atlassian Confluence 9.2.21 Printed by Atlassian Confluence 9.2.21 Report a bug Atlassian News Atlassian {"serverDuration": 58, "requestCorrelationId": "bab7ac563dc14229"}