3 Replies Latest reply on Mar 23, 2006 5:14 AM by jameswoodward

    FacesMessages

    jameswoodward Newbie

      First of all, nice work on integrating the Internationalization features.

      A couple of suggestions:

      1) Can you make it more lenient when a message does not exist in the resource bundle. Currently it gives a stack trace, it would be more forgiving for it to show the name of the missing resource as per JSF and MyFaces e.g. ??? applicationTitle ???

      2) Can you make it search for resources in more than one messages.properties file. I currently have a cascading resource bundle scheme, where if it doesn't find a resource in the current applications bundle, it then delegates to a shared bundle. This allows global resources, such as copyright messages, to be changed in one place only.

      Here's how it hangs together:

      In the application I have:
      MessageBundle.class
      Messages.properties

      I reference the properties file from the faces-config.xml:

      <message-bundle>uk.co.mclgroup.ncc.resources.MessageBundle</message-bundle>
      


      The application MessageBundle.class is as follows:
      public class MessageBundle extends shared.MessageBundle {
       public MessageBundle() {
       super(MessageBundle.class);
       }
      }
      


      The application Messages.properties contains application specific resources:
      applicationName=My Test Application


      In the shared JAR I have:
      MessageBundle.class
      Messages.properties

      The shared MessageBundle.class is as follows:
      public abstract class MessageBundle extends ResourceBundle {
      
       private ResourceBundle bundle;
      
       protected MessageBundle(Class clazz) {
       super();
       bundle = ResourceBundle.getBundle(clazz.getPackage().getName() + ".Messages");
       setParent(ResourceBundle.getBundle(MessageBundle.class.getPackage().getName() + ".Messages"));
       }
      
       protected Object handleGetObject(String key) {
       Object obj = null;
      
       try {
       obj = bundle.getObject(key);
       } catch (MissingResourceException e) {
       }
      
       return obj;
       }
      
       public Enumeration getKeys() {
       return bundle.getKeys();
       }
      }
      


      The shared Messages.properties contains common resources:
      copyright=Copyright © 2006 My Company Name
      version=Version: #{initParam.version}




        • 1. Re: FacesMessages
          Gavin King Master

          (1) I thought it is already working like that in CVS.
          (2) Add a request to JIRA.

          • 3. Re: FacesMessages
            jameswoodward Newbie

            1) Nope, definitely not lenient in jboss-seam-CVS20060322. If a resource is missing from the bundle I get the following stack trace:

            SEVERE: Error Rendering View[/listParts.jsf]
            javax.faces.el.EvaluationException: /listParts.jsf @26,73 value="#{messages.note}": org.jboss.seam.core.Messages$1
             at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
             at oracle.adf.view.faces.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:55)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.ValueRenderer.getValue(ValueRenderer.java:63)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.ValueRenderer.getConvertedString(ValueRenderer.java:32)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.OutputTextRenderer.encodeEnd(OutputTextRenderer.java:56)
             at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:163)
             at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
             at oracle.adfinternal.view.faces.uinode.UIComponentUINode._renderComponent(UIComponentUINode.java:317)
             at oracle.adfinternal.view.faces.uinode.UIComponentUINode.render(UIComponentUINode.java:262)
             at oracle.adfinternal.view.faces.uinode.UIComponentUINode.render(UIComponentUINode.java:239)
             at oracle.adfinternal.view.faces.ui.composite.ContextPoppingUINode$ContextPoppingRenderer.render(ContextPoppingUINode.java:224)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:346)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:301)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderChild(BaseRenderer.java:412)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderIndexedChild(BaseRenderer.java:330)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderIndexedChild(BaseRenderer.java:222)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderContent(BaseRenderer.java:129)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.render(BaseRenderer.java:81)
             at oracle.adfinternal.view.faces.ui.laf.base.xhtml.XhtmlLafRenderer.render(XhtmlLafRenderer.java:67)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:346)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:301)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderChild(BaseRenderer.java:412)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderNamedChild(BaseRenderer.java:384)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderNamedChild(BaseRenderer.java:352)
             at oracle.adfinternal.view.faces.ui.laf.base.xhtml.BorderLayoutRenderer.renderContent(BorderLayoutRenderer.java:75)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.render(BaseRenderer.java:81)
             at oracle.adfinternal.view.faces.ui.laf.base.xhtml.XhtmlLafRenderer.render(XhtmlLafRenderer.java:67)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:346)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:301)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderChild(BaseRenderer.java:412)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderIndexedChild(BaseRenderer.java:330)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderIndexedChild(BaseRenderer.java:222)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.renderContent(BaseRenderer.java:129)
             at oracle.adfinternal.view.faces.ui.BaseRenderer.render(BaseRenderer.java:81)
             at oracle.adfinternal.view.faces.ui.laf.base.xhtml.XhtmlLafRenderer.render(XhtmlLafRenderer.java:67)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:346)
             at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:301)
             at oracle.adfinternal.view.faces.ui.composite.UINodeRenderer.renderWithNode(UINodeRenderer.java:90)
             at oracle.adfinternal.view.faces.ui.composite.UINodeRenderer.render(UINodeRenderer.java:36)
             at oracle.adfinternal.view.faces.ui.laf.oracle.desktop.PageLayoutRenderer.render(PageLayoutRenderer.java:76)
             at oracle.adfinternal.view.faces.uinode.UIXComponentUINode.renderInternal(UIXComponentUINode.java:177)
             at oracle.adfinternal.view.faces.uinode.UINodeRendererBase.encodeEnd(UINodeRendererBase.java:53)
             at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
             at oracle.adfinternal.view.faces.renderkit.RenderUtils.encodeRecursive(RenderUtils.java:54)
             at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeChild(CoreRenderer.java:232)
             at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeAllChildren(CoreRenderer.java:255)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:65)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:117)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:147)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:60)
             at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.delegateRenderer(CoreRenderer.java:271)
             at oracle.adfinternal.view.faces.renderkit.core.xhtml.DocumentRenderer.encodeAll(DocumentRenderer.java:60)
             at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:159)
             at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
             at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
             at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
             at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:521)
             at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:157)
             at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:51)
             at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
             at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
             at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
             at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
             at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
             at org.
            10:13:50,078 ERROR [STDERR] apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
             at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
             at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
             at java.lang.Thread.run(Thread.java:595)
            Caused by: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key note
             at java.util.ResourceBundle.getObject(ResourceBundle.java:325)
             at java.util.ResourceBundle.getString(ResourceBundle.java:285)
             at org.jboss.seam.core.Messages$1.get(Messages.java:49)
             at org.jboss.seam.core.Messages$1.get(Messages.java:73)
             at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:67)
             at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
             at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
             at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
             at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
             at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
             ... 88 more