I need to save separate state information for each open Firefox tab. Since
Firefox shares the same session between all tabs I need to dream up another way
besides using session. I am using Firefox 2.0.
I have been experimenting with "<t:saveState" and find it works great when I
submit a form and go to another form via a rule, but I lose my state when I
execute an "<h:outputLink". I am using Shale 1.1.0 (yesterday's snapshot) with
the included Tiles. I have created a simple example, described below.
The neat part of this method is that I have a single StateBean for all my "tab
state" data and a single reference to saveState in my Tiles header. I can
merrily go through my three test jsp forms for each tab with different "tab
state" forever without losing my "tab state" (as test3 branches back to test1).
But in my test2 I also have a "<h:outputLink" that goes to test3, and if I
click this link I lose my state.
It would be great if this could work. Any help would be greatly appreciated.
Here are my test details.
For my test I am using the logonName in my StateBean. I added this logic to my
logon Class:
stateBean = new StateBean();
stateBean.setLogonName(this.getLogonName());
setStateBean(stateBean);
String ab = "#{requestScope.stateBean}";
getApplication().createValueBinding(ab).setValue(facesContext, stateBean);
My Tiles header.jsp has the saveState:
...
<t:saveState id="stateBeanSS" value="#{stateBean}"/>
...
Here are the rules:
<navigation-rule>
<from-view-id>/systemLogon.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/testTest1.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/testTest1.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/testTest2.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/testTest2.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/testTest3.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/testTest3.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/testTest1.jsp</to-view-id>
</navigation-case>
</navigation-rule>
And here are my jsps:
testTest1.jsp
...
<h:form>
<h:outputText value="Test1 stateBean = #{stateBean},
#{stateBean.logonName}"/>
<h:commandButton action="#{testTestBean.submit}" value="Submit"/>
</h:form>
testTest2.jsp
...
<h:form>
<h:outputText value="Test2 stateBean = #{stateBean},
#{stateBean.logonName}"/>
<h:commandButton action="#{testTestBean.submit}" value="Submit"/>
</h:form>
<h:outputLink
value="#{facesContext.externalContext.requestContextPath}/testTest3.faces">
<h:outputText value="Test3"/>
</h:outputLink>
testTest3.jsp
...
<h:form>
<h:outputText value="Test3 stateBean = #{stateBean}, #{stateBean.logonName}"/>
<h:commandButton action="#{testTestBean.submit}" value="Submit"/>
</h:form>
Dick