You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by "Mike Arnold (JIRA)" <be...@incubator.apache.org> on 2005/06/17 23:44:16 UTC

[jira] Created: (BEEHIVE-827) FacesMessages unavailable in JSF

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


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


[jira] Resolved: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Rich Feit (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=all ]
     
Rich Feit resolved BEEHIVE-827:
-------------------------------

    Fix Version: V1
     Resolution: Fixed
      Assign To:     (was: Rich Feit)

Fixed with revision 191736.  Mike, let me know if this resolves the issue you're having.

Thanks,
Rich

> 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
>      Fix For: V1

>
> 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


[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Mike Arnold (JIRA)" <be...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314151 ] 

Mike Arnold commented on BEEHIVE-827:
-------------------------------------

I think the workaround would be fine for me, personally.  I think for the sake of JSF integration with PageFlows, however, the ability to modify the FacesContext instance for the current request is important.  I haven't tried it yet with PageFlows, but you know the FacesContext also provides access to the component tree for an associated view.  My assumption would be that access to the component tree after an action has been raised for the current request may also be affected by this issue.  That could be a bigger issue than just the messages.

> 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


[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Mike Arnold (JIRA)" <be...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314410 ] 

Mike Arnold commented on BEEHIVE-827:
-------------------------------------

I examined the comments in the PageFlowViewHandler class and determined that the issue I was having is because in my forward I was using navigateTo=Jpf.NavigateTo.currentPage.   If, instead, I forward to a specific path, the onCreate method executes and I can retrieve the pageInput.


@Jpf.Action(forwards = {
@Jpf.Forward(name = "loginSuccess", path = "confirmLogin.faces"),
@Jpf.Forward(name = "loginFailure", path="login.faces", actionOutputs = {
    @Jpf.ActionOutput(name="loginError", type = String.class, required = true)
})
})



@Jpf.Action(forwards = {
@Jpf.Forward(name = "loginSuccess", path = "confirmLogin.faces"),
@Jpf.Forward(name = "loginFailure", navigateTo=Jpf.NavigateTo.currentPage, actionOutputs = {
    @Jpf.ActionOutput(name="loginError", type = String.class, required = true)
})
})

I suspect that using navigateTo is the appropriate way of sending the user back to the page, but I can think of no other place to call getPageInput() and retrieve the output from the action.  I think, based on your comments, that the way I'm doing this now is probably fine.  If you'd still be interested in seeing the code, I'd be happy to attach it here.

Things are working great now, and I'm grateful for your assistance.  I'm also quite impressed with the JSF/JPF integration.  Kudos to everyone involved.

 

> 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
>      Fix For: V1

>
> 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


[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Rich Feit (JIRA)" <be...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314404 ] 

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

OK, I have a question and a comment:

    - If you ever get out to an action, we should destroy the current backing bean, so when you get back to the page, onCreate() should be called (on a new instance of the backing bean).  I have a test of this and it appears to be working (both with MyFaces and the JSF RI), but I'm wondering if there's a difference between our apps.  Can you attach your app, or at least a set of files I can use to reproduce the problem?

    - onCreate() will only get called when the backing bean is created, and not on subsequent postback requests to the same JSF page.  I think you're aware of this but I want to make sure.  If you need to execute code on every request in order to set up messages in the FacesContext, then I think this would need to be done through JSF.  Does that make sense?

> 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
>      Fix For: V1

>
> 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


[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Rich Feit (JIRA)" <be...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314159 ] 

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

I agree, and I think I can actually move creation of the backing bean inside the Faces request (right before the view is created/restored).  It's a little tricky in terms of lifecycle... just exploring it now.  But assuming it all works correctly, I'll have the fix checked in by tonight.

> 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


[jira] Updated: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Rich Feit (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=all ]

Rich Feit updated BEEHIVE-827:
------------------------------

    Assign To: Rich Feit

> 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


Re: [jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by Rich Feit <ri...@gmail.com>.
Mike,

Sorry, I missed your comment on the bug on Wednesday.  I'll look at this 
now.

Rich

Mike Arnold (JIRA) wrote:

>    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314256 ] 
>
>Mike Arnold commented on BEEHIVE-827:
>-------------------------------------
>
>It appears the onCreate() method is no longer executed when returning from the action, so there appears to be no place to getPageInput() to retrieve the message and place into FacesContext.  Do you have a recommendation as to how I can best retrieve the ActionOutput from inside my backing bean?  Do I need to forward to a different faces view in order to execute getPageInput() from the onCreate() method of a new backing bean?
>
>  
>
>>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
>>     Fix For: V1
>>    
>>
>
>  
>
>>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)
>>    
>>
>
>  
>

[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Mike Arnold (JIRA)" <be...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314256 ] 

Mike Arnold commented on BEEHIVE-827:
-------------------------------------

It appears the onCreate() method is no longer executed when returning from the action, so there appears to be no place to getPageInput() to retrieve the message and place into FacesContext.  Do you have a recommendation as to how I can best retrieve the ActionOutput from inside my backing bean?  Do I need to forward to a different faces view in order to execute getPageInput() from the onCreate() method of a new backing bean?

> 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
>      Fix For: V1

>
> 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


[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Rich Feit (JIRA)" <be...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/BEEHIVE-827?page=comments#action_12314429 ] 

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

Thanks Mike!  I'm glad the integration is working for you so far.  I agree that there doesn't seem to be an easy way to do what you want.  With revision 201684, I've added an onRestore() callback to FacesBackingBean, and I think it fits the bill.  It's called whenever you end up at a backing bean through navigateTo=Jpf.NavigateTo.{currentPage,previousPage}.  There's an example of this at netui/test/webapps/jsf/jsfWeb/onRestore -- I think it's similar to the case you're describing.  If you end up using this feature, let me know if you run into any problems with it.

> 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
>      Fix For: V1

>
> 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


[jira] Commented: (BEEHIVE-827) FacesMessages unavailable in JSF

Posted by "Rich Feit (JIRA)" <be...@incubator.apache.org>.
    [ 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