You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tom Innes <To...@allTiers.com> on 2006/10/27 19:31:19 UTC

Conversation - Message on ensureConversation and Conflict with PRG Pattern

Hi Mario,

 

I have been doing some more testing with the Conversation Component and I
have some more opportunities.

 

I am trying to get the Conversation functionality working.  When I use
ensureConversation and the user is redirected to another page, I would like
to have the user notified via a message.  I have added the MESSAGER context
Parameter and yet the message is not displayed. For right now I am using the
DefaultConversationMessager Class.  Any suggestions on how to get this to
work would be appreciated.

 

I have added this to the web.xml

<context-param>

      <param-name>org.apache.myfaces.conversation.MESSAGER</param-name>

 
<param-value>org.apache.myfaces.custom.conversation.DefaultConversationMessa
ger</param-value>

  </context-param>

 

And I have a Messages Component on my Form as follows:

                        <h:messages

                              styleClass="error-text"

                              showDetail="true"

                              showSummary="true"

                              >

                        </h:messages>

 

 

  Also previous to this I was using the Post Redirect Get Pattern to
automatically redirect all pages.  When I use this pattern all Data and
Messages are lost if I use this Phase Listener together with the
Conversation Components.  Any Ideas?

 

http://learnjsf.com/wp/2006/08/06/a-prg-phase-listener-for-jsf/

 

 

Tom 


Re: Conversation - Message on ensureConversation and Conflict with PRG Pattern

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Tom!
>
> I am trying to get the Conversation functionality working.  When I use
> ensureConversation and the user is redirected to another page, I would
> like to have the user notified via a message.  I have added the
> MESSAGER context Parameter and yet the message is not displayed. For
> right now I am using the DefaultConversationMessager Class.  Any
> suggestions on how to get this to work would be appreciated.
>
>  
>
>   Also previous to this I was using the Post Redirect Get Pattern to
> automatically redirect all pages.  When I use this pattern all Data
> and Messages are lost if I use this Phase Listener together with the
> Conversation Components.  Any Ideas?
>
Yea, you have to install such a phaseListener which will save/restore
your messages.
The ensureConversation guy will also redirect to the new view in case of
a not running conversation.

You could use our solution to this by activating the redirectTracker
(yet another piece of code from me - and unfortunately undocumented ;-) )

A quick start up might be to add this to your web.xml:
<context-param>
    <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
   
<param-value>org.apache.myfaces.custom.redirectTracker.policy.MessagesRedirectTrackPolicy</param-value>

</context-param>

There are other policies which allow you to save request beans too,
please see [1] if you would like to see some discussion about this
thingy, e.g. a policy which allows you to manually capture messages
and/or beans, etc ...

Ciao,
Mario

[1] http://issues.apache.org/jira/browse/TOMAHAWK-503