You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2009/06/21 04:29:02 UTC

[trinidad] does not support browser back button

When we use jsf ri and tomahawk, our jsf app works well for browser back button. But after we use Trinidad, browser back button does not work. Consider the following senario:
 
1. show a table of employees (backing bean data is a list of employees)
2. click an employee A and show the employee,(backing bean data is now changed to the employee)
3. click browser back button
4. click an employee B.  Employee B will not be shown because the backing data has been changed to employee A in stop 2.
 
I looked the generated HTML viewState values in the steps above. They are  the same. That means that only the same view(stored view tree in server side) is used. For jsf/tomahawk, I believe different view  trees are used for the senario above and thus back button works.
 
Is there a config parameter for trinidad to support back button?
Back button is often used by users, it is nice if we can do that with Trinidad.
 
Thanks,
Dave


      

Re: [trinidad] does not support browser back button

Posted by Andrew Robinson <an...@gmail.com>.
Backing beans are separate from pages, so clicking a back button does
not change the backing beans, it is up to the application developer to
manage the backing beans. So in your example, it is typical to have 2
beans, one being the table backing and one being the current row. Then
when an edit link is clicked, the current row bean stores the current
one. Clicking back then gets you to the table again, and clicking the
edit link resets the current row bean's value again. Something like
this:

<tr:table value="#{items}" var="i">
  <tr:column>
    <tr:commandLink text="Edit" action="editItem">
      <f:setPropertyActionListener
        value="#{i}"
        target="#{editBean.item}" />
    </tr:commandLink>
  </tr:column>
</tr:table>

public class ItemsBean
{
  private List<Item> items;
  public List<Item> getItems() { return items; }
}

public class ItemBean
{
  private Item item;
  public void setItem(Item item) { this.item = item; }
  public Item getItem() { return item; }
}

Then you can either store these beans in session scope, conversation
scope (with 3rd party support) or request scope and pass an ID or
serialize the item data between requests to an input hidden (with
t:saveState for example).

I have had no problems with the back button in Trinidad when I have
developed with it in the past, so there should be no issues with it
unless you are using the application view cache, which I strongly
recommend against using.

-Andrew


On Sat, Jun 20, 2009 at 8:29 PM, Dave<ja...@yahoo.com> wrote:
> When we use jsf ri and tomahawk, our jsf app works well for browser back
> button. But after we use Trinidad, browser back button does not work.
> Consider the following senario:
>
> 1. show a table of employees (backing bean data is a list of employees)
> 2. click an employee A and show the employee,(backing bean data is
> now changed to the employee)
> 3. click browser back button
> 4. click an employee B.  Employee B will not be shown because the backing
> data has been changed to employee A in stop 2.
>
> I looked the generated HTML viewState values in the steps above. They are
> the same. That means that only the same view(stored view tree in server
> side) is used. For jsf/tomahawk, I believe different view  trees are used
> for the senario above and thus back button works.
>
> Is there a config parameter for trinidad to support back button?
> Back button is often used by users, it is nice if we can do that with
> Trinidad.
>
> Thanks,
> Dave
>