I'm having a bit of trouble using the s:cache JSF component in combination with my h:selectOneListBox's.
If I place the <s:cache /> tags just after the <ui:define /> tags (just like the Blog example shows), like so
<ui:define name="body">
<s:cache key="index" region="pageFragments">
...
<h:form id="foo">
<h:selectOneListBox id="foo" value="#{myFoo}">
<si:selectItems var="foo" value="#{fooList.resultList}" />
</h:selectOneListBox>
<h:commandButton id="select" action="#{select}" value="Select Foo">
</h:form>
...
<h:form id="bar">
<h:selectOneListBox id="bar" value="#{myBar}">
<si:selectItems var="bar" value="#{barList.resultList}" />
</h:selectOneListBox>
<h:commandButton id="select" action="#{select}" value="Select Bar">
</h:form>
...
</s:cache>
</ui:define>
I can select an item from one of the lists and submit the form once. But when I come back to the page I have "" text in the page, and can no longer submit any of the forms on the page.
If I put the <s:cache /> tag directly around each <h:selectOneListBox />
<ui:define name="body">
...
<h:form id="foo">
<s:cache key="index-foo" region="pageFragments">
<h:selectOneListBox id="foo" value="#{myFoo}">
<si:selectItems var="foo" value="#{fooList.resultList}" />
</h:selectOneListBox>
<h:commandButton id="select" action="#{select}" value="Select Foo">
</s:cache>
</h:form>
...
<h:form id="bar">
<s:cache key="index-bar" region="pageFragments">
<h:selectOneListBox id="bar" value="#{myBar}">
<si:selectItems var="bar" value="#{barList.resultList}" />
</h:selectOneListBox>
<h:commandButton id="select" action="#{select}" value="Select Bar">
</s:cache>
</h:form>
...
</ui:define>
I can submit the forms but, I have to click the submit button twice. The first time I get "value is not valid" (as if there was no selected item). Pressing the button again, submits the form.
Is there something special I have to do in order to get the <s:cache /> to work with my <h:selectOneListBox /> tags?