struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurizio Cucchiara <maurizio.cucchi...@gmail.com>
Subject Re: Setting and Getting Variables
Date Wed, 17 Nov 2010 00:35:11 GMT
What about using
<s:set var="backgroundImage"
value="'background-image:url(' + customImageFileUrl + ');'" />

<s:property value="backgroundImage"/>


2010/11/16 Dave Westerman <dlwester@us.ibm.com>

> I am having a lot of trouble getting my head around how to access the
> different variables in Struts and JSP, and it's causing me all kinds of
> problems.
>
> All I am trying to do is set a variable in my page from a variable in my
> Action class, in order to use it at various places in my page.
>
> <s:set var="backgroundImage"
> value="'background-image:url(\"%{customImageFileUrl}\");'" />
>
> The result is:
> customImageFileUrl = /social/aggregator/sitetemp/site1/i_bg-hdr-sma.jpg
> backgroundImage = background-image:url("%{customImageFileUrl}");
>
> I've tried '#' instead of '%', and it also takes that as a literal. I've
> tried '$' instead of '%', and also using <s:property>, but both of those
> give me JSP compile errors.
>
> Is there some way to put the value of 'customImageFileUrl' from my action
> class into a variable that I can use in the page?
>
> Thanks!




-- 
Maurizio Cucchiara

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message