[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    complex tag nesting?
From:       Dale Newfield <Dale () Newfield ! org>
Date:       2007-09-28 22:36:41
Message-ID: 46FD81F9.4050205 () Newfield ! org
[Download RAW message or body]

I'm pretty sure I remember someone asking this question before, but I 
was unable to find it either in my archives or in nabble...

I basically want "includeParams" for a specific parameter, and I thought 
I could do it just by conditionally including the parameter like so:

<a href='<s:url action="removeFavorite" namespace="">
            <s:param name="mediaCode" value="%{media.code}"/>
            <s:if test="%{#parameters.decorator.length > 0}">
              <s:param name="decorator" value="%{#parameters.decorator}"/>
            </s:if>
            </s:url>'><fmt:message key="viewMedia.removeFavorite"/></a>

It doesn't work.

I guess I can always include the param and just change the value based 
on a condition:

<a href='<s:url action="removeFavorite" namespace="">
            <s:param name="mediaCode" value="%{media.code}"/>
            <s:param name="decorator" 
value="%{(#parameters.decorator.length > 0)?(#parameters.decorator):('')}"/>
            </s:url>'><fmt:message key="viewMedia.removeFavorite"/></a>

but I wanted to ask if there's any sensible way to make the first 
solution work?  I understand that the s:if tag is conditionally allowing 
the body to be added to the output, which is different from 
conditionally deciding whether or not to execute the body, and I 
understand that it's likely the s:url tag understands s:param children 
but not s:if children...
...but I could see a desirable use-case where someone wants to nest an 
s:iterator inside a s:url, too, and it would be nice if these types of 
constructs could work...

-Dale

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic