You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by andy wix <st...@hotmail.com> on 2005/05/24 17:55:51 UTC

setting String in scope (JSTL)

Hi,

I am trying to set a string variable in page scope and thought the following 
would work:

<c:set var="background" scope="page" value="tableLightColour"/>

I was hoping that I would then be able use the variable as in the following:

<tr class="${background}">

but it doesn't work.

If I just use:
<TR class="tableLightColour">

the css attributes are seen as expected.

regards,
Andy

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


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


[OT] Re: setting String in scope (JSTL)

Posted by Rahul Akolkar <ra...@gmail.com>.
On 5/24/05, andy wix <st...@hotmail.com> wrote:
<snip/>
> I was hoping that I would then be able use the variable as in the following:
> 
> <tr class="${background}">
> 
> but it doesn't work.

Is EL working in template text in other JSPs in the same context? Do
you have a servlet 2.4 web app descriptor? Please see question 1 here
[ http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions ]

-Rahul

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


Re: setting String in scope (JSTL)

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "andy wix" <st...@hotmail.com>

> I am trying to set a string variable in page scope and thought the
following
> would work:
> <c:set var="background" scope="page" value="tableLightColour"/>
> I was hoping that I would then be able use the variable as in the
following:
> <tr class="${background}">
> but it doesn't work.
> If I just use:
> <TR class="tableLightColour">
> the css attributes are seen as expected.

What does the generated HTML look like... do you see the literal
${background} in the HTML?  Are you using a JSP 2.0 container, so that you
expect expressions to be evaluated anywhere in the page?

If you're not using JSP 2.0, try this:  <tr class="<c:out
value='${background}'/>">

-- 
Wendy Smoak


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