[ 
http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314137 
] 

Rich Feit commented on BEEHIVE-827:
-----------------------------------

I'm still looking at this, and trying to figure out if there's any way to move 
onCreate() inside the Faces request, or whether it's fishy to plug the 
FacesContext factory in order to create the FacesContext earlier in the 
request... or if either of these is really desirable.  The issue here (which 
you've probably already discerned) is that you're adding FAcesMessages to the 
previous request's FacesContext.

One quick thing to note is that you can bind directly to page inputs from 
pages, using an expression like "#{pageInput.myPageInput.someProperty}".  I 
think this issue is still worth exploring, but out of curiosity, would that 
work for you?

> FacesMessages unavailable in JSF
> --------------------------------
>
>          Key: BEEHIVE-827
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-827
>      Project: Beehive
>         Type: Bug
>   Components: NetUI
>     Versions: v1m1
>  Environment: Sun JSF-ri, Tomcat 5.0.28
>     Reporter: Mike Arnold
>     Assignee: Rich Feit

>
> I created a FacesBackingBean that raises an action in the controller.  The 
> action returns a Forward sending the request back to the JSF.  The forward 
> generates an ActionOutput of a simple String message.  In the onCreate() 
> method of the FacesBackingBean I called getPageInput() to retrieve the 
> ActionOutput.  I then cast the output as a string and pass it to a new 
> FacesMessage which is passed to FacesContext.getInstance().addMessage().  In 
> the JSF, the message is not displayed using the <h:messages/> tag.
> If I add the new FacesMessage to FacesContext in an event handler that does 
> not raise an action, the message is displayed as expected.
> If I add the new FacesMessage to FacesContext in onCreate() without going 
> through an action, the statement throws a NPE.
> @Override
> protected void onCreate() throws Exception {
>      FacesContext.getCurrentInstance().addMessage("foo", new 
> FacesMessage("bar"));
> }
> Stack Trace:
> java.lang.NullPointerException
>       at petstoreAdmin.login.onCreate(login.java:30)
>       at 
> org.apache.beehive.netui.pageflow.PageFlowManagedObject.create(PageFlowManagedObject.java:62)
>       at 
> org.apache.beehive.netui.pageflow.internal.FacesBackingBeanFactory.getFacesBackingBeanForRequest(FacesBackingBeanFactory.java:73)
>       at 
> org.apache.beehive.netui.script.common.ImplicitObjectUtil.loadImplicitObjects(ImplicitObjectUtil.java:161)
>       at 
> org.apache.beehive.netui.pageflow.PageFlowPageFilter.runPage(PageFlowPageFilter.java:271)
>       at 
> org.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(PageFlowPageFilter.java:205)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at 
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>       at 
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
>       at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
>       at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>       at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
>       at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
>       at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to