Hi, I don't know the exact explanation and reasons why it behaves that way, but looking at the code I can say it's by design :)
<s:param/> tag doesn't play alone, you must use it in context of other tag so it is natural that its "value" attribute should be evaluated as an expression - you can read this as: evaluate expression of "value" attribute and assign its result to property of "name" attribute. You can call it a "named expression" :) Other tags' "value" attribute has the same meaning as value attribute of normal html tags (ie. <input/>) - it represent that tag's value. You can tell Struts to evaluate "value"'s value by defining an expression with %{} or ${} - it forces Struts to treat "value"'s value as OGNL expression - it has nothing to do with EL expressions. In that context you can treat <s:param/> as manifestation of %{}/${} but result of evaluating "value" attribute will be assigned to property named by "name" attribute. ${}/%{} is an anonymous though :) I hope you will understand, if not ask :) Regards -- Lukasz 2016-03-04 18:30 GMT+01:00 Steven Willis <swil...@cargurus.com>: > I was having some issues with how freemarker/struts handles the 'value' > attribute on the 'param' tag. I figured it out and saw that struts will try > to evaluate any string passed in to 'value'. Freemarker had been evaluating > my expressions, sending in the resulting string to struts, and struts was > evaluating it again. > > After figuring that out, I assumed that other tags, like 'hidden' would > behave the same way with their 'value' attribute, but that doesn't appear to > be the case. It seems like I need to do the following for the 'param' tag: > > <@s.param name="foo" value="someProperty"/> > > But with the hidden tag (or I'm assuming any form-based tag) I have to do: > > <@s.hidden name="foo" value=someProperty/> > > or: > > <@s.hidden name="foo" value="${someProperty}"/> > > Is this the expected behavior? And if so, why the different handling of the > value attribute between the different tags? This page: > https://struts.apache.org/docs/tag-syntax.html#TagSyntax-valueisanObject%21 > seems to indicate that all value attributes are evaluated and even gives the > example of a textfield. But the behavior I'm seeing with hidden is that if > you used value="someProperty", you'd get the literal string value: > "someProperty" in the html, not the result of evaluating "someProperty" > against the value stack. > > Also, the table of parameters for all of the following tags: > > https://struts.apache.org/docs/hidden.html > https://struts.apache.org/docs/textarea.html > https://struts.apache.org/docs/textfield.html > https://struts.apache.org/docs/param.html > > Indicate that 'value' is a String field, even on the param page where the > 'Description' section indicates exactly the opposite. > > Is there a place I could see definitively which attributes are evaluated > against the value stack and which are taken as-is? Or am I just > missing/not-understanding something (very likely)? > > -Steven Willis --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org