I am currently working with a project, I have multiple select box in my application, each values should change according to the previous value selected in the first list, here i
There is a huge mess in your code. Keep in mind that:
block
in your bean and hospitalfloor
in your action are missing them.bean
property defined anywhere, while in the JSP page you are referencing it several times (bean.state
, bean.country
etc).If you need to post something (and since you are posting the value from select1 to populate select2, you need it), you must put your elements inside a form. In the specific case of <sj:select/>
, don't put an action
attribute in the form itself, because you are already specifying an action url from the href
attribute of <sj:select/>
s:
<s:form>
<!-- stuff -->
<sj:select ... />
<!-- stuff -->
<sj:select ... />
<!-- stuff -->
</s:form>
The flow should be:
<sj:select name = "bean.country"
list = "countries"
listKey = "id"
listValue = "description"
href = "%{loadCountriesAction}"
value = "%{bean.country}"
onChangeTopics = "reloadState"
onCompleteTopics = "reloadState" />
<sj:select name = "bean.state"
list = "states"
listKey = "id"
listValue = "description"
href = "%{loadStatesAction}"
value = "%{bean.state}"
reloadTopics = "reloadState"
deferredLoading = "true" />