动态更改一个Struts2 select标签的内容 [英] Change content of one Struts2 select tag dynamically

查看:25
本文介绍了动态更改一个Struts2 select标签的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Struts 2 <s:select>标签;一个代表国家,另一个代表国家:

I have two Struts 2 <s:select> tags; one for the country, and another for the state:

<s:select label="country" headerKey="-1" headerValue="Select country" list="country"       name="countryID" />

<s:select label="state" headerKey="-1" headerValue="Select state" list="state"   name="stateID" />

"country"选择更改时,我只想显示该国家/地区的状态.

When the "country" select changes I want to show only that country's states.

我该怎么做?

推荐答案

您可以使用Struts2 doubleselect标签.它

You can use Struts2 doubleselect tag. It

渲染两个HTML select元素,第二个选择元素根据第一个选择的条目更改显示值.

Renders two HTML select elements with second one changing displayed values depending on selected entry of first one.

<s:doubleselect label="Select country/state" name="country" list="{'country1','other'}" doubleName="state" doubleList="top == 'country1' ? {'state1', 'state2'} : {'state3', 'state4'}" />

有关真实示例,请参见 Struts 2 <s:doubleselect>示例

For the real example see Struts 2 <s:doubleselect> example.

这篇关于动态更改一个Struts2 select标签的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆