Thanks for the quick response.

It seems like it could actually be the setter method that is the culprit
rather than the "resources.getString("key"));". If I do System.outs on "key"
(see below) I get the correct value every time I use the tag on its own in a
JSP (i.e. both key1 and key2 has a value), but the moment I use it in my
other tag the second value is null/empty. I think it's got something to do
with scope maybe ... but unsure what else to do as my other tags work fine
it is just this one...

public void setKey(String key) throws JspException {
 System.out.println("key1="+key);
 this.key = (String)ExpressionEvaluatorManager.evaluate("key", key,
String.class, this, super.pageContext);
 System.out.println("key2="+this.key);
}

Thanks again, much appreciated.

-----Original Message-----
Kris Schneider <[EMAIL PROTECTED]> wrote:

The stack trace seems to indicate that the property file is located just
fine,
but that the file does not contain a key called "key". If the property file
could not be located, ResourceBundle.getBundle() should be throwning the
exception, not ResourceBundle.getString().


-----Original Message-----
From: Marius Botha [*mailto:[EMAIL PROTECTED]<[EMAIL PROTECTED]>]

Sent: 26 June 2007 03:40
To: taglibs-user@jakarta.apache.org
Subject: Resource Bundle Problem (sometimes)

Hi there,

I have my own tag (extending BodyTagSupport) in which I do the following:

<code>
ResourceBundle resources = ResourceBundle.getBundle("application");
out.print(resources.getString("key"));
</code>

This works great ... most of the time. However, the moment I put this tag
into another tag that I wrote (a Data Table Tag - extending LoopTagSupport)
I get the following exception(below). For some reason it seems to find the "

application.properties" resource file when my tag is on its own somewhere on
the JSP, but when I try to use it in another tag, it doesn't work. Any
ideas?

Much appreciated.

Marius Botha

Exception:

java.util.MissingResourceException: Can't find resource for bundle
java.util.PropertyResourceBundle, key
java.util.ResourceBundle.getObject(ResourceBundle.java:326)
java.util.ResourceBundle.getString(ResourceBundle.java:286)
com.workpool.struts.component.html.MessageTag.doEndTag(MessageTag.java:32)

Reply via email to