Return-Path: Delivered-To: apmail-shale-issues-archive@locus.apache.org Received: (qmail 36381 invoked from network); 13 Sep 2006 07:42:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Sep 2006 07:42:57 -0000 Received: (qmail 96064 invoked by uid 500); 13 Sep 2006 07:42:56 -0000 Delivered-To: apmail-shale-issues-archive@shale.apache.org Received: (qmail 96037 invoked by uid 500); 13 Sep 2006 07:42:56 -0000 Mailing-List: contact issues-help@shale.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shale.apache.org Delivered-To: mailing list issues@shale.apache.org Received: (qmail 96023 invoked by uid 99); 13 Sep 2006 07:42:56 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Sep 2006 00:42:56 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from ([209.237.227.198:36010] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1 r(10620)) with ESMTP id 87/D0-08414-F86B7054 for ; Wed, 13 Sep 2006 00:43:11 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9579F714341 for ; Wed, 13 Sep 2006 07:39:31 +0000 (GMT) Message-ID: <26776449.1158133171609.JavaMail.jira@brutus> Date: Wed, 13 Sep 2006 00:39:31 -0700 (PDT) From: "Adrian Mitev (JIRA)" To: issues@shale.apache.org Subject: [jira] Commented: (SHALE-269) Convenient programmatic access to localized messages In-Reply-To: <28765649.1157058991628.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/struts/browse/SHALE-269?page=comments#action_38200 ] Adrian Mitev commented on SHALE-269: ------------------------------------ A good idea too is to add method for error message using the component id instead of the component object. Thisway the developer won't need to have a binding to the component only to add an error message. Also method for finding component in the root will be useful: public static UIComponent findComponentInRoot(String id) { return getFacesContext().getViewRoot().findComponent(id); } Methods for navigation: public void gotoView(String viewName) { if (viewName!= null) { UIViewRoot view = getApplication().getViewHandler().createView(getFacesContext(),viewName); getFacesContext().setViewRoot(view ); } } public void navigate(String fromView,String outcome) { getApplication().getNavigationHandler().handleNavigation(getFacesContext(),fromView, outcome); } > Convenient programmatic access to localized messages > ---------------------------------------------------- > > Key: SHALE-269 > URL: http://issues.apache.org/struts/browse/SHALE-269 > Project: Shale > Issue Type: New Feature > Components: Core > Affects Versions: 1.0.3 > Reporter: Craig McClanahan > Priority: Minor > > From the Shale User Mailing List (Adrian Mitev ): > ========== > Hi! It is a good idea to add method like addMessageFromBundle that > does something like this: > public void addMessageFromBundle(UIComponent component,String > bundleMessageKey) { > ResourceBundle bundle = null; > try { > bundle = ResourceBundle.getBundle(getFacesContext() > .getApplication().getMessageBundle()); > String message = bundle.getString(bundleMessageKey); > error(componeng,message); > } catch (MissingResourceException e) { > e.printStackTrace(); > } > } > ========== > We might also look at ways to provide for parameter replacement in such messages. > Seam also has a cute utility that lets you build messages out of EL expressions for parameter replacement. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira