Exact, the exception should be thrown earlier, at the point of execution in the
action bean...I've done
public void addLocalizableMessage(final String messageKey){
try {
LocalizableMessage message = new
LocalizableMessage(messageKey);
message.getMessage(getContext().getLocale());
getContext().getMessages().add(message);
} catch (MissingResourceException e) {
log.error("MissingResourceException "+e.toString());
}
}
Greetings
--- El mié, 6/10/10, Newman, John W <[email protected]> escribió:
De: Newman, John W <[email protected]>
Asunto: Re: [Stripes-users] Bug stripes messages
Para: "Stripes Users List" <[email protected]>
Fecha: miércoles, 6 de octubre, 2010 21:12
I think he’s saying that the exception should be thrown earlier, at the point
of execution in the action bean, rather than after the fact in the jsp. Seems
reasonable to me, but either way it’s basically the same thing. Bottom line
is get your keys correct and test both bean/jsp.
You could change that to
ResourceBundle resourceBundle = <get a reference to your resource bundle
however>;
getContext (). getMessages (). add (new SimpleMessage
(resourceBundle.getMessage("miss.message.text")));
From: Frank Pavageau [mailto:[email protected]]
Sent: Wednesday, October 06, 2010 2:22 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Bug stripes messages
On Wed, Oct 6, 2010 at 7:43 PM, andres <[email protected]> wrote:
I discovered a bug in the Stripes messages.
If you add in the action, message that does not exist
getContext (). getMessages (). add (new LocalizableMessage ("miss.message.text
"));
and in jsp
<s:messages/>
will fail in the jsp
GRAVE:
java.util.MissingResourceException: Can not find resource for bundle ...
I can catch with a try in jsp but it is ugly, another option, is to check
message if exist before add to messages.
Jsp should not fail, giving blank message or replaced by another generic error
message.
It's not a bug, it's a feature. It's supposed to fail with an exception if you
use an invalid key. Otherwise it would go mainly unnoticed.
Frank
-----Adjunto en línea a continuación-----
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
-----Adjunto en línea a continuación-----
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users