You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonio Petrelli <an...@gmail.com> on 2008/10/15 08:38:08 UTC

Re: How to pass a tiles attribute into an s:url

2008/10/14 928572663 <92...@cox.net>:
> <s:submit type='image'>
>   <s:param name="src">
>      <s:url value="<tiles:insertAttribute name='image'/>" />
>   </s:param>
> </s:submit>

You can't nest a JSP tag into another.
If "image" is a string, then you can do this:

<tiles:importAttribute name="image" />
<s:submit type='image'>
  <s:param name="src">
     <s:url value="${image}" />
  </s:param>
</s:submit>

HTH
Antonio

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


Re: How to pass a tiles attribute into an s:url

Posted by 928572663 <92...@cox.net>.
I found that this syntax will work (although there may be a more elegant 
way to do this)


<tiles:importAttribute name="image_url" scope="request" />

<s:submit type='image'>
    <s:param name="src">
       <s:url value="%{#request.image_url}" />
    </s:param>
</s:submit>


-John


Antonio Petrelli wrote:
> 2008/10/15 928572663 <92...@cox.net>:
>>           <s:url value="${image_url}" />
> 
> Oh yes, sorry! Struts tags do not support EL anymore, so you have to
> use the corresponding OGNL expression (that I don't know).
> 
> Antonio
> 


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


Re: How to pass a tiles attribute into an s:url

Posted by 928572663 <92...@cox.net>.
Thanks Antonio for the reply.

When I changed the code to do this I am now getting a JSP compile error:

  Static attribute must be a String literal, its illegal to specify an 
expression.
	   <s:url value="${image_url}" />
                              ^---^

I then commented out this line and added a JSTL expression just to see 
what happens:


<c:if test="${image_url == '/images/next_button.gif'}">
    <h1>JSTL worked and image_url was found</h1>
</c:if>

and the page renders with the <h1> tag included.

Any ideas?

Thanks,
John



Antonio Petrelli wrote:
> 2008/10/14 928572663 <92...@cox.net>:
>> <s:submit type='image'>
>>   <s:param name="src">
>>      <s:url value="<tiles:insertAttribute name='image_url'/>" />
>>   </s:param>
>> </s:submit>
> 
> You can't nest a JSP tag into another.
> If "image" is a string, then you can do this:
> 
> <tiles:importAttribute name="image" />
> <s:submit type='image'>
>   <s:param name="src">
>      <s:url value="${image_url}" />
>   </s:param>
> </s:submit>
> 
> HTH
> Antonio
> 


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