struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mitch gorman <mgor...@shadowtv.com>
Subject EL question
Date Wed, 13 May 2009 15:12:19 GMT

    this isn't specifically a struts question, but perhaps it may help
someone else (besides, hopefully, me) to ask it here.

    i've read Chris Pratt's posts of 5/11 on the "Access to ValueStack
from JSPs" thread... i'm just hoping the answer isn't to manually do the
interpretation, as he stated in those posts.

    okay, so, my scenario doesn't even involve a struts tag, it's a
displaytag tag, but i think it's a general point about ELs that is the
issue at hand.  here's the deal:  we use a servlet to serve up the
images we're putting on to the pages we're rendering.  the app is
basically a templated storefront, and a vendor can tweak it, even down
to the little piddly graphics like the images in the paging controls, as
you'll see in the code fragment below:

     <dt:setProperty name="paging.banner.full" value="<div
class='pagelinks' align='right'> <a href={1}><img
src='/default/resources/images/vendor/first'></a> <a href={2}><img
src='/default/resources/images/vendor/prev'></a> {0} <a href={3}><img
src='/default/resources/images/vendor/next'></a>  <a href={4}><img
src='/default/resources/images/vendor/last'></a></div>" />

    the issue is, see that "/default" in those image source paths? 
that's the context path.  what i *really* want to write is something like:

 <dt:setProperty name="paging.banner.full" value="<div class='pagelinks'
align='right'> <a href={1}><img src='<s:property value="contextPath"
/>/resources/images/vendor/first'></a> <a href={2}><img
src='<s:property value="contextPath"
/>/resources/images/vendor/prev'></a> {0} <a href={3}><img
src='<s:property value="contextPath"
/>/resources/images/vendor/next'></a>  <a href={4}><img src='<s:property
value="contextPath" />/resources/images/vendor/last'></a></div>" />

    is there any way to get my substitution injected, like that?  (i'm
assuming this would apply to any taglib-based tag, but feel free to
correct me if i'm wrong about that.)  i've tried all the
notations/syntaxes i could think of, %{}, ${}, even tried building the
tags via both java (<% %>) and javascript, and either <%= %>'ing it or
document.write()'ing it into the page... nothing worked.  in the end,
since in practice it's only my dev environment that differs from my
integration, staging, and production environments (which are all the
same), i kludged my way through it by writing two complete sets of
<dt:setProperty> tags, wrapped by <s:if></s:if><s:else></s:else>.

    isn't there a more elegant & efficient way to accomplish what i want?

-- 
Mitch Gorman
mgorman@shadowtv.com
(215) 764-6310
Skype: mitch.shadowtv.com


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


Mime
View raw message