True, thanks for the additional comments. I tried to keep my post short, so
I concentrated on expressions only... :)
Btw, the solution "with extra EL sauce" was what I had originally in my
code:
<s:text name="${title}"/>
And yes, that works... However, I never enjoyed having JSP code (including
EL) in my pages, unless absolutely necessary. So far, I haven't really
bumped into anything that couldn't be solved with S2 tags with some OGNL :)
Regards,
Dj.
-----Original Message-----
From: Dave Newton [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 04, 2007 5:44 PM
To: Struts Users Mailing List
Subject: RE: [S2] <s:text> issue
--- Djordje Trifunovic <[EMAIL PROTECTED]> wrote:
> because unlike in <s:properties> and some other
> tags, in <s:text> %{...} cannot be omitted.
Just as a clarification; the reason it can't be
omitted in *your* case is because you needed to
evaluate an expression to be used as the name
attribute.
Using <s:text name="package.text1"/> would retrieve a
value from package.properties keyed with
"package.text1".
Using <s:text name="%{packageText1Key}"/> would
retrieve a value from package.properties set with
whatever your Action set its property packageText1Key
to.
Using <s:text name="%{#pkgtxt1}"/> would retrieve a
value keyed with whatever you <s:set.../> pkgtxt1 to,
for example, <s:set name="pkgtxt1"
value="%{'package.text1'}"/>, which evaluates an
immediate string.
Similarly, if you <s:set name="pkgtxt1"
value="packageText1Key"/> then #pkgtxt1 would evaluate
to whatever the Action had set its packageText1Key
property to.
Mmmm, OGNL, with extra EL sauce.
If you made it this far, try (in a JSP 2.0 container):
<s:text name="${actionText1Key}"/>
And throw yet another different EL in there for grins.
:D
Dave
____________________________________________________________________________
________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]