myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: [Trinidad] State saving between applications
Date Sat, 14 Jul 2007 16:34:42 GMT
Ah, yes.  Well, Trinidad offers a ChangeManager feature
that can be used to persist component state.  What you'd
do is add a rangeChangeListener to the table like so:

public void persistRangeChange(RangeChangeEvent event)
{
  // Create the change
  AttributeComponentChange change =
     new AttributeComponentChange("first", event.getNewStart());

  // Get some contexts
  FacesContext   fc =  FacesContext.getCurrentInstance();
  RequestContext rc = RequestContext.getCurrentInstance();

  // Register it for the table
  rc.getChangeManager().addComponentChange(
    fc, event.getComponent(), change);
}

Make sure you have:
  <context-param>
    <param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
    <param-value>session</param-value>
  </context-param>

in your web.xml to enable the feature.

-- Adam

On 7/12/07, St├ęphane Poirier <stephane.poirier01@gmail.com> wrote:
> Sorry, my description wasn't completely right as I re-read it. I'll take it
> over correctly with an example :
>
> I'm in "JSP 1" which contains a <tr:table> (with it's default navigation
> menu) and a <tr:selectOneChoise>. Changing the selectOnChoise changes the
> table data using partialTriggers and an action in the backing bean. At that
> point, if I redirect to another application and come back, JSP 1 will
> restore to the state it was.
>
> However, if I use the table navigation to see the third page of data (for
> example) then redirect to another application and come back, the JSP 1 will
> show the first page of data instead of the third. That is my problem.
>
>
>
>
> On 7/12/07, Adam Winer <awiner@gmail.com> wrote:
> > There shouldn't be any difference between redirecting
> > after AJAX or redirecting after a standard request.
> > The state should be the same.  I'm not sure
> > what you're describing.
> >
> > -- Adam
> >
> >
> > On 7/12/07, St├ęphane Poirier <stephane.poirier01@gmail.com> wrote:
> > > Hi,
> > >
> > > I have 2 different Trinidad applications interacting. Beeing different
> > > applications, I'm using ExternalContext.sendRedirect() to go from an
> > > application to another. It works well (tho it's not very clean) and the
> > > state of components is the same when the page is revisited (beans are in
> > > session scope). My problem is when I'm using AJAX with partialTrigers.
> If
> > > I'm using a redirect in an action after AJAX, the state will not be
> saved (I
> > > understand that it's the normal behavior). Still, I want to solve this
> > > problem. Any ideas?
> > >
> > > I read that ViewHandler could possibly help... is that right? If so, an
> > > implementation hint would be greatly appreciated! :-)
> > >
> > > Thanks in advance!
> > >
> >
>
>

Mime
View raw message