I don't know if this can helps you but there is the way to handle
messages throw redirects, the Matt Raible' way  into appFuse/JSF :


the message filter :
https://appfuse.dev.java.net/source/browse/appfuse/extras/jsf/src/web/org/appfuse/webapp/filter/MessageFilter.java?rev=1.1&view=auto&content-type=text/vnd.viewcvs-markup

the BasePage with addMessage method
https://appfuse.dev.java.net/source/browse/appfuse/extras/jsf/src/web/org/appfuse/webapp/action/BasePage.java?rev=1.1&view=auto&content-type=text/vnd.viewcvs-markup







2005/8/5, Martin Marinschek <[EMAIL PROTECTED]>:
> 
> 
> ---------- Forwarded message ----------
> From: Martin Marinschek <[EMAIL PROTECTED]>
> Date: Aug 5, 2005 11:05 AM 
> Subject: Re: Messages and navigation rule redirects post
> To: Johannes Hiemer <[EMAIL PROTECTED]>
> 
> Nice solution,
>  
>  even though a bit verbose... You might want to try a phase-listener wich
> you add before the render response phase and which checks for this bean and
> adds the messages to the context instead of doing that in a bean as well.
>  
>  regards,
>  
>  Martin
> 
> 
> On 8/5/05, Johannes Hiemer < [EMAIL PROTECTED]> wrote:
> > 
> > Hi Richard, Hi Martin,
> > perhaps I got something. I took my time this morning and spend it trying
> some things. In my implementation I got a standard BaseController for all my
> handlers. So I thought, why should I use this BaseController to save this
> message for a while. After a few minutes I got a working solution.
> > Here is my code:
> > 
> > ##### BaseController #####
> > 
> > private static FacesMessage notification;
> > 
> >         /**
> >          * @return Returns the notification. 
> >          */
> >         public FacesMessage getNotification() {
> >                 return notification;
> >         }
> > 
> >         /**
> >          * @param notification The notification to set.
> >          */
> >         public void setNotification(FacesMessage notification) { 
> >                 this.notification = notification;
> >         }
> > 
> > ###### faces-config.xml ########
> > 
> > <managed-bean>
> >                
> <managed-bean-name>BaseController</managed-bean-name>
> >                 <managed-bean-class> 
> >                        
> itecon.web.resource.BaseController
> >                 </managed-bean-class>
> >                
> <managed-bean-scope>session</managed-bean-scope>
> >         </managed-bean> 
> > 
> > 
> > This is my BaseController, now we get to the SparepartHandler.java where
> actually the first stept happens.
> > 
> > public String add() {
> >                 message = this.getMessage();
> >                  log.info (message);
> >                 String notification =
> Utils.getMessageResourceBundle(getBundle(), "internalDatasetExists", null,
> getLocale());
> >                 setNotification(new
> FacesMessage(FacesMessage.SEVERITY_INFO, notification, notification));
> >                 return message;
> >         }
> > 
> > As you can see, I get my notification from my ResourceBundle of the
> Application. After the I put it through BaseController.setNotification into
> my private static FacesMessage notification;
> > Till here - fine.
> > 
> > No I have a second managed bean called: NotificationHandler.
> > 
> > ##### NotificationHandler.java #######
> > 
> > public class NotificationHandler extends BaseController implements
> Serializable { 
> > 
> >         private String hiddenField = null;
> > 
> >         public void pageLoad() {
> >                 log.info(getNotification());
> >                 facescontext.addMessage("globalMessage",
> getNotification());
> >         }
> > 
> >         /**
> >          * @return Returns the hiddenField.
> >          */
> >         public String getHiddenField() {
> >                 return hiddenField;
> >         }
> > 
> >         /** 
> >          * @param hiddenField The hiddenField to set.
> >          */
> >         public void setHiddenField(String hiddenField) {
> >                 this.hiddenField = hiddenField;
> >         }
> > }
> > 
> > The hiddenField was created because I don't know another way to initialize
> the managed-bean through my success.jspx
> > That's my managed bean in my faces-config.xml
> > 
> > ###### faces-config.xml #####
> > <managed-bean>
> >                
> <managed-bean-name>notificationSpringBean</managed-bean-name>
> >                 <managed-bean-class> 
> >                        
> itecon.web.controller.NotificationHandler
> >                 </managed-bean-class>
> >                
> <managed-bean-scope>session</managed-bean-scope>
> >                 <managed-property> 
> >                        
> <property-name>pageLoad</property-name>
> >                         <value>true</value>
> >                 </managed-property>
> >         </managed-bean>
> > 
> > And last but not least my success.jspx.
> > 
> > ####### success.jspx ######
> > 
> > <h:form id="form">
> >         <h:panelGrid columns="3" styleClass="parentTable"
> headerClass="tableHeader" columnClasses="childTable">
> >                 <f:facet name="header">
> >                         <h:outputText id="closer"
> value="YIIPPIIEIIOOO SCHWEINEBACKE" />
> >                 </f:facet>
> >                 <h:inputHidden id="hiddenField"
> value="#{notificationSpringBean.hiddenField}" />
> >                 <x:messages id="globalMessage" layout="table"
> >                 showSummary="true" showDetail="false" />
> >         </h:panelGrid>
> > </h:form>
> > 
> > 
> > As attachement the result.
> > To proove it:
> > Here the extract of my Resources.properties
> > internalDatasetExists=Dataset already exists 
> > 
> > Try it, tell me If I am wrong, or if there better ways to do it.
> > 
> > Regards Johannes
> > 
> >
> ______________________________________________________________
> > Verschicken Sie romantische, coole und witzige Bilder per SMS! 
> > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> > 
> > 
> > 
> > 
> 
>  


-- 

hicham ABASSI
[EMAIL PROTECTED]

Reply via email to