2016-03-04 20:06 GMT+01:00 Steven Willis <swil...@cargurus.com>:
> I think I understand what you're saying, a param tag doesn't correspond to 
> any directly generated html tag, so its 'value' attribute is special and gets 
> evaluated. Whereas other tags, like 'hidden' correspond to html elements that 
> actually have a 'value' attribute themselves, so the literal value you pass 
> in just gets set straight on the html element.

That's good but forget all these as I was wrong :)

> However, this page 
> https://struts.apache.org/docs/tag-syntax.html#TagSyntax-valueisanObject%21 
> says the following:
>
>> Since value is not a String, whatever is passed to value is evaluated as an 
>> expression - NOT a String literal.
>>
>> <s:textfield key="state.label" name="state" value="ca"/>
>>
>> If a textfield is passed the value attribute "ca", the framework will look 
>> for a property named getCa.
>
>
> That seems like it's describing the behavior I experience (and you describe) 
> for the 'param' tag where the string gets evaluated, and not what I 
> understand you to be saying should happen with 'textfield' and other 'input' 
> type tags. I actually just tried with 'hidden' and 'textfield' tags and any 
> plain string (no %{} or ${}) inside quotes is inserted literally into the 
> html and not evaluated. So is the description at the URL given above 
> incorrect? Should it only be about the 'value' attribute on the 'param' tag? 
> Are there other tags whose 'value' attributes act like 'param'?

Yes, that's the proper behaviour but there is an option called
"altSyntax" which modifies Struts' behaviour when to treat a String as
an expression. And as it is set to "true" by default, Struts assumes
that all expressions must be enclosed in %{} as in other case they
won't be evaluated. The "altSyntax" comes from WebWork and the whole
framework is written based on such assumption. And I think "altSyntax"
option should be dropped but %{} must remain required for expressions.

https://struts.apache.org/docs/alt-syntax.html


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to