[
https://issues.apache.org/jira/browse/WW-3338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115868#comment-18115868
]
Lukasz Lenart commented on WW-3338:
-----------------------------------
Verified on current main with a rendering test. The hidden tag is not the odd
one out: every UI tag whose value type is String (hidden, textfield, password,
textarea, select and the rest) treats the value attribute as a String
attribute, parsed only for the expression notation. Only checkbox and file
evaluate value as an expression, as do the generic tags such as property, set
and iterator. This is the documented rule 1 on the Tag Syntax page: String
attributes are parsed for the expression notation, non-String attributes are
evaluated directly.
Flipping the default so that value on form tags is always evaluated as OGNL
would break every page that passes a literal, for no gain over the existing
notation:
{code}value="%{myprop}"
{code}
So this stays as designed and is closed as Won't Fix.
One real finding: the "value is an Object!" section on the Tag Syntax page
claims that a textfield with value="ca" looks for a getCa property. It does
not; it renders the literal "ca". That section contradicts the three-rule
summary further down the same page and is almost certainly what caused this
report. It will be fixed on the documentation site.
> <s:hidden> tag should interpret its value attribute same as the other tags do.
> ------------------------------------------------------------------------------
>
> Key: WW-3338
> URL: https://issues.apache.org/jira/browse/WW-3338
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - Tags
> Affects Versions: 2.1.8
> Reporter: Andreas Krüger
> Priority: Major
> Fix For: 7.4.0
>
>
> According to http://struts.apache.org/2.1.8.1/docs/tag-syntax.html , any
> attribute value="" is interpreted for OGNL.
> This is not true for {{<s:hidden ... value="myprop" />}} , which will use the
> literal string "myprop".
> To get it to call my bean's getMyprop(), I need to say {{<s:hidden ...
> value="%\{myprop}" />}}
> Would be nice if this could be streamlined, so s:hidden conforms to the
> general principle.
> As that change might break existing code, it might be more easily asked for
> than done.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)