struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts-site git commit: Adds missing Alt Syntax page
Date Thu, 21 Sep 2017 10:12:52 GMT
Repository: struts-site
Updated Branches:
  refs/heads/master 46a2618ca -> 27a47e7f8


Adds missing Alt Syntax page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/27a47e7f
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/27a47e7f
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/27a47e7f

Branch: refs/heads/master
Commit: 27a47e7f8b4ee49327d98587468c003b887561c8
Parents: 46a2618
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Thu Sep 21 12:12:40 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Thu Sep 21 12:12:40 2017 +0200

----------------------------------------------------------------------
 source/tag-developers/alt-syntax.md | 57 ++++++++++++++++++++++++++++++++
 source/tag-developers/index.md      |  2 +-
 2 files changed, 58 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/27a47e7f/source/tag-developers/alt-syntax.md
----------------------------------------------------------------------
diff --git a/source/tag-developers/alt-syntax.md b/source/tag-developers/alt-syntax.md
new file mode 100644
index 0000000..db41f97
--- /dev/null
+++ b/source/tag-developers/alt-syntax.md
@@ -0,0 +1,57 @@
+---
+layout: default
+title: Tag Developers Guide (WIP)
+---
+
+# Alt Syntax
+
+The _altSyntax_ is an option that can be defined in `struts.xml`. 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.
+
+> 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](tag-syntax.html):
+
+```jsp
+<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:
+
+```jsp
+<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](tag-syntax.html) 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.

http://git-wip-us.apache.org/repos/asf/struts-site/blob/27a47e7f/source/tag-developers/index.md
----------------------------------------------------------------------
diff --git a/source/tag-developers/index.md b/source/tag-developers/index.md
index b9c7efc..f352dbb 100644
--- a/source/tag-developers/index.md
+++ b/source/tag-developers/index.md
@@ -18,7 +18,7 @@ The framework offers a flexible view layer that supports multiple view technolog
   - [OGNL Basics](ognl-basics.html)
   - [OGNL Expression compilatio](ognl-expression-compilation.html)
 - [Tag Syntax](tag-syntax.html)
-- _Alt Syntax_ 
+- [Alt Syntax](alt-syntax.html) 
 - [JSP](jsp.html)
   + [specific tags](jsp-tags.html)
 + [FreeMarker](freemarker.html)


Mime
View raw message