You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by albert kao <al...@gmail.com> on 2021/06/10 00:06:21 UTC

s:url s:a and s:text

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.

Re: s:url s:a and s:text

Posted by Lukasz Lenart <lu...@apache.org>.
czw., 10 cze 2021 o 02:07 albert kao <al...@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org