Hi,I have a page that contains a state selection, and a city(list) selection
for that each state selected. The city list could be updatedif the state
selection is changed. So, I use @Persist("client") to store the"state" lists.
User could choose multiple "cities" in the selection and the city list could be
very long and come from a List of City class which contains a "name", "index",
and "checked" etc fields.
My question is what is the best way to get multiple selection results back when
user click submit. I don't want to "persist" the "City" list because it has a
PageLink linking to other page. I found out that if the city list get too long,
the PageLink seems got disabled on IE. The city list is retrieved from other
source on the fly and it is not stored in the db.
But, it seems that the "cities list" comes back null when I click "Submit" if I
don't persist them in the java code.
I know that I could persist a boolean array of "Selection" and "bind" the
"selected" to "Selection -- but it needs to retrieve the city list multiple
times during "state" change, kind not efficient.
Could anyone let me know best way to solve this issue?Thanks,
Ajit Raj
------------------------- Page file ------------------------------
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="com.test.CityChooser">
<component id="form" type="Form">
<binding name="listener" value="listener:formSubmit"/>
<binding name="refresh" value="listener:onRefresh"/>
</component>
<component id="locationsSelects" type="Select">
<binding name="mutiple" value="true"/>
<binding name="validators" value="validators:required"/>
</component>
<component id="locationList" type="Foreach">
<binding name="source" value="ognl:cities"/>
<binding name="value" value="ognl:currentCity"/>
<binding name="index" value="ognl:currentCityIndex"/>
</component>
<component id="locationOption" type="Option">
<!-- <binding name="selected" value="ognl:selection[currentCityIndex]"/>
-->
<binding name="selected" value="ognl:currentCity.checked"/>
<binding name="label" value="ognl:currentCity.name"/>
</component>
<component id="states" type="PropertySelection">
<binding name="model" value="ognl:states"/>
<binding name="value" value="ognl:state"/>
</component>
</page-specification>
_________________________________________________________________
Missed the show? Watch videos of the Live Earth Concert on MSN.
http://liveearth.msn.com