czw., 10 cze 2021 o 02:07 albert kao <albertk...@gmail.com> napisał(a):
>
> How to use s:url s:a and s:text together?
> I tried this jsp but it did not work because some s:text did not get
> substituted.
>
> <s:url var="compHref" action='s:text name="comp.href"/>'/>
> <s:a href="%{compHref}" title="<s:text
> name="browser.window.title"/>"><s:text name="common.test.button"/></s:a>
>
>
>
> .properties file
> comp.href=https://www.mycomp.com/client.html#x1
> browser.window.title=Title
> common.test.button=Test
>
>
>
> I tried to modify this jsp but then it did not compile :(.
> Please help.
> Thanks.

It won't work that way, you can use <s:set/> like this

<s:set var="compHref">
  <s:text name="comp.href"/>
</s:set>
<s:set var="wndTitle">
  <s:text name="browser.window.title"/>
</s:set>

<s:a href="%{compHref}" title="%{wndTitle}"><s:text
name="common.test.button"/></s:a>

And you shouldn't use <s:url/> if the "action" attribute doesn't point
to an action.


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