I moved the code from scriptlet into phase listener. Any hint on how I can skip it in included pages
(ui:include) is greatly appreciated.

Thanks,
--MG


On 8/26/06, Mikhail Grushinskiy <[EMAIL PROTECTED]> wrote:
Is phase listener going to be called for pages included with <ui:include> from this page?
If it is I need to do it only for this page. How can I detect in phase listener whether it is for main page
or for included one? (I do not have to delete bean from session in included page)


On 8/26/06, Matthias Wessendorf < [EMAIL PROTECTED]> wrote:
if this is a use case for *each* request, I suggest using a PhaseListener.
for a special page, take a look at Shale's ViewController.
that has a init() method to do some things *before* the page is rendered.

mixing jsp/jsf is not really a good/maintainalbe thing ;)

On 8/26/06, Mikhail Grushinskiy <[EMAIL PROTECTED] > wrote:
> How to clean up bean from session when using facelets? I need to remove bean
> if the request contains cleanupFlag parameter.
> When I used JSP I did it with this small _javascript_let at the begining of
> the page.
>
> <jsp: directive.page
>
> import=" javax.faces.context.FacesContext,javax.faces.component.UIViewRoot,javax.faces.application.ViewHandler"
>   contentType="text/html;charset=iso-8859-1"
>   buffer="64kb"/>
>    <jsp:scriptlet>
>         if(request.getParameter("cleanupFlag") != null) {
>
> FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("formBean");
> {
>           // recreate view
>           FacesContext facesContext = FacesContext.getCurrentInstance();
>
> facesContext.getApplication().createValueBinding("#{formBeanId}").setValue(facesContext,
> null);
>          ViewHandler viewHandler =
> facesContext.getApplication().getViewHandler();
>          UIViewRoot newRoot = viewHandler.createView(facesContext,
> facesContext.getViewRoot().getViewId());
>          facesContext.setViewRoot (newRoot);
>          }
>        }
>  </jsp:scriptlet>
>
> Thanks, --MG
>
>
>


--
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com


Reply via email to