Hi all,

I'm using struts 1.1.

I have localized application resources keys defined in my tiles
definition file. In my JSP, I use the tiles attribute and then display
the localized message using the key.

However, in some cases, the localized value is empty: there is no value
for that particular locale or that particular instance. In those cases,
I want to avoid writing out the key at all, but I'm having trouble
figuring out how to make that test.

Specifically, I have tiles defs like this:

        <definition name=".manageHierarchy.billing.details"
extends=".template.manageHierarchy.billing">
                <put name="directionToUser"
value="tiles.module.admin.manageHierarchy.billing.details.directionToUse
r"/>
Etc.
</definition>

And the localized values are something like

tiles.main.admin.manageHierarchy.businessStruc.add.directionToUser=

(so no value for that key).  

In my JSP, I've tried several ways to test whether the key value is null
or the length is 0, but none of them have worked yet. For example:

<tiles:useAttribute id="directionToUser" name="directionToUser"
classname="java.lang.String" ignore="true"/>
<% if(directionToUser != null && directionToUser.length()>0){
%>
        <div class="modFormBox"><bean:message
key="<%=directionToUser.toString()%>"/></div>
<%
}%>

Problem here is that directionToUser is the key, not the value, so it's
never null, and I get the empty div tags I'm trying to avoid. So I tried
variations like this:

<tiles:useAttribute name="directionToUser"
classname="java.lang.String"/>
        
<bean:define id="directionToUserString">
        <bean:message name="directionToUser"/>
</bean:define>
        
<logic:notEmpty name="directionToUserString">
        <div class="modFormBox"><bean:write
name="directionToUserString"/></div>
</logic:notEmpty>

That one returned "Define tag can contain only one of name attribute,
value attribute, or body content". I've tried lots of variations similar
to that, but haven't struck upon the right one yet. This SEEMS like
something which should be pretty simple, but I'm missing something. Any
suggestions? Thanks!
Chris Loschen


_______________
Siebel
IT'S ALL ABOUT THE CUSTOMER
Visit www.siebel.com

This e-mail message is for the sole use of the intended recipient(s) and 
contains confidential and/or privileged information belonging to Siebel 
Systems, Inc. or its customers or partners. Any unauthorized review, use, 
copying, disclosure or distribution of this message is strictly prohibited. If 
you are not an intended recipient of this message, please contact the sender by 
reply e-mail and destroy all soft and hard copies of the message and any 
attachments. Thank you for your cooperation.

Reply via email to