You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Marco Gattei <ma...@gmail.com> on 2010/02/11 11:12:28 UTC

Stateful Page removing

 Is it possible to programatically remove a stateful page from user session
? *
*I'm using a stateful page to implement an object creation form.
When user request a new object creation i want to remove the stateful page
to make sure that
the page for object creation (A_Page) it ic recreated form scratch:

I tried this portion of code,

 public boolean onNewClick()
   {

//      getContext().removeSessionAttribute( ""+A_Page.class);


       getContext().setSessionAttribute( ""+A_Page.class ,null);

       A_Page dest = (A_Page) getContext().createPage(A_PageA_Page.class);

       setForward(dest);
       return false;
   }


but create page is still getting page from HttpSession .....

What i'm doing wrong ?
Maybe ""+A_Page.class ins't the correct name in session map of the page ?

thanks

-- 
Marco

Re: Stateful Page removing

Posted by Marcelo Grassi Franco Melgaço <mg...@gmail.com>.
Try this:
getContext().removeSessionAttribute(getClass().getName());




2010/2/11 Marco Gattei <ma...@gmail.com>:
> Is it possible to programatically remove a stateful page from user session ?
> I'm using a stateful page to implement an object creation form.
> When user request a new object creation i want to remove the stateful page
> to make sure that
> the page for object creation (A_Page) it ic recreated form scratch:
>
> I tried this portion of code,
>
>  public boolean onNewClick()
>    {
>
> //      getContext().removeSessionAttribute( ""+A_Page.class);
>
>
>        getContext().setSessionAttribute( ""+A_Page.class ,null);
>
>        A_Page dest = (A_Page) getContext().createPage(A_PageA_Page.class);
>
>        setForward(dest);
>        return false;
>    }
>
>
> but create page is still getting page from HttpSession .....
>
> What i'm doing wrong ?
> Maybe ""+A_Page.class ins't the correct name in session map of the page ?
>
> thanks
>
> --
> Marco
>

Re: Stateful Page removing

Posted by Marco Gattei <ma...@gmail.com>.
The stattement  ""+A_Page.class doesn't generate only the class name, un
also prepends "class " ,
A_Page.class.getName() did the work.


2010/2/11 WarnerJan Veldhuis <wa...@qprcostcontrol.com>

>  You call Page.setStateful(false).  It will be checked every request.
>
>
>
>
> On 02/11/2010 11:12 AM, Marco Gattei wrote:
>
> Is it possible to programatically remove a stateful page from user session
> ? *
> *I'm using a stateful page to implement an object creation form.
> When user request a new object creation i want to remove the stateful page
> to make sure that
> the page for object creation (A_Page) it ic recreated form scratch:
>
> I tried this portion of code,
>
>  public boolean onNewClick()
>    {
>
> //      getContext().removeSessionAttribute( ""+A_Page.class);
>
>
>        getContext().setSessionAttribute( ""+A_Page.class ,null);
>
>        A_Page dest = (A_Page) getContext().createPage(A_PageA_Page.class);
>
>        setForward(dest);
>        return false;
>    }
>
>
> but create page is still getting page from HttpSession .....
>
> What i'm doing wrong ?
> Maybe ""+A_Page.class ins't the correct name in session map of the page ?
>
> thanks
>
> --
> Marco
>
>


-- 
Marco

Re: Stateful Page removing

Posted by WarnerJan Veldhuis <wa...@qprcostcontrol.com>.
You call Page.setStateful(false).  It will be checked every request.



On 02/11/2010 11:12 AM, Marco Gattei wrote:
> Is it possible to programatically remove a stateful page from user 
> session ? *
> *I'm using a stateful page to implement an object creation form.
> When user request a new object creation i want to remove the stateful 
> page to make sure that
> the page for object creation (A_Page) it ic recreated form scratch:
>
> I tried this portion of code,
>
>  public boolean onNewClick()
>    {
>
> //      getContext().removeSessionAttribute( ""+A_Page.class);
>
>
>        getContext().setSessionAttribute( ""+A_Page.class ,null);
>
>        A_Page dest = (A_Page) getContext().createPage(A_PageA_Page.class);
>
>        setForward(dest);
>        return false;
>    }
>
>
> but create page is still getting page from HttpSession .....
>
> What i'm doing wrong ?
> Maybe ""+A_Page.class ins't the correct name in session map of the page ?
>
> thanks
>
> -- 
> Marco