Thanks for your help, Paul.

I'm trying that, but I'm getting the same results as I did when I used
<tiles:useAttribute .../> originally. That is, I'm getting the key, not
the value, so I still need to get the value to determine whether it's
empty. But when I try to define a bean as the value of <bean:message
key="..."/>, it fails when that value is empty (which is what I was
trying to check for in the first place!).

The project I'm working on is using struts 1.1, so I don't think I have
access to the EL tags -- am I mistaken?

Chris

-----Original Message-----
From: Benedict, Paul C [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 09, 2005 12:17 PM
To: 'Struts Users Mailing List'
Subject: RE: Test whether an application resource is empty

Chris,

Use <tiles:importAttribute .... ignore="true"> to bring in the key.
You can then use EL to test if it is empty or whatever.

Thanks,
Paul

-----Original Message-----
From: Chris Loschen [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 09, 2005 11:37 AM
To: Struts Users Mailing List
Subject: RE: Test whether an application resource is empty
Importance: High


I'm sorry to keep sending this over and over again, but I'm really
stuck. If this isn't possible, could someone let me know? Then I could
try to find an alternate path.

Chris 

-----Original Message-----
From: Chris Loschen 
Sent: Wednesday, June 08, 2005 5:09 PM
To: Struts Users Mailing List
Subject: RE: Test whether an application resource is empty

I'm still spinning my wheels on this -- does anyone have any ideas?

Quick synopsis: I have localized i18n messages defined in my tiles
definitions which are sometimes empty. I need to test that the value
associated with a given key is not empty before I proceed with further
processing. I can test that the key is non-empty, but I haven't yet
figured out how to test the same thing for the value. If anyone could
help, I'd really appreciate it.

Thanks!

Chris

-----Original Message-----
From: Chris Loschen
Sent: Wednesday, June 08, 2005 1:12 PM
To: Struts Users Mailing List
Subject: Test whether an application resource is empty

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.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





------------------------------------------------------------------------
------
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
and in Japan, as Banyu) that may be confidential, proprietary
copyrighted and/or legally privileged. It is intended solely for the use
of the individual or entity named on this message.  If you are not the
intended recipient, and have received this message in error, please
notify us immediately by reply e-mail and then delete it from your
system.
------------------------------------------------------------------------
------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





_______________
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.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to