<s:select list="接收的集合list或map,set" listKey="id" name="要传的参数名"
listValue="typeName" headerKey="要传的参数值"
headerValue="显示的内容(headerKey的value)" />
headerValue : 默认值value
headerKey : 默认name
list : 源数据 (可以在action方法里从数据库获取list)
name : 被选数据存放的位置(这里我方在对象obj的属性值userName中<需在action中定义该对象>)
listKey : 下拉选项的name
listValue : 下拉选项的value
value : 默认值
如下例:
<s:select list="#request.typelist" listKey="id" name="id"
listValue="typeName" headerKey="%{#goods.type.id}" headerValue="%{#goods.type.typeName}" />
其中:
#request.typelist为获取从action传过来的参数 typelist(一个集合)
name=“id” 中的id为要传的参数,在action中有对应的getter,setter方法
%{#goods.type.typeName} 为jsp页面要显示的内容
%{#goods.type.id} 为要传的参数id的值,与显示的内容相对应
listKey即对应于select标签中的value, listValue即对应于select标签中的option。
不知道这样理解对不对,有什么不足