struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: string concatenation within an EL conditional
Date Tue, 10 May 2011 16:30:00 GMT
On Tue, May 10, 2011 at 11:44 AM, Scott Koenig wrote:
> This may fall under nested EL expressions, which to my understanding are
> intentionally disallowed, but I was wondering if there was EL syntax that
> would support what I am trying to do, namely, set a URL based on a
> conditional, or if I should stick with <s:if>.
>
> Currently I have
>
> <s:if test="mn == #m.name">
>    <a href="#landing">${m.dispName}</a>
> </s:if>
> <s:else>
>    <a href="/internal!m?cName=${cName}&mName=${m.name}">${m.dispName}</a>
> </s:else>
>
> but would like to do it in a single line, something like
>
> <a href="${mn == m.name ? '#landing' : '/internal!m?cName=' + cName + '&mName='
+ m.name}">${m.dispName}</a>

Yuck; unreadable. Stick it in a custom tag where it belongs. That much
computation doesn't belong in the mainline JSP.

Does the one-liner version not work?

Dave

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


Mime
View raw message