Struts 2 页面控件使用1



要使用s:select 下来列表框控件


private List<ResourceType> resourceTypeList;
有getResourceTypeList方法,

@Override
public String execute() throws Exception {
LOG.debug("Let us say hello");
resourceTypeList = new ArrayList<ResourceType>();

ResourceType rt1 = new ResourceType();
rt1.setName("Diagram");
rt1.setDescription("Flow Diagram");
resourceTypeList.add(rt1);

ResourceType rt2 = new ResourceType();
rt2.setName("Word");
rt2.setDescription("Word Document");
resourceTypeList.add(rt2);

return SUCCESS;
}



<s:select name="rcType" list=" resourceTypeList" listKey="name"  listValue="description" headerKey="0" headerValue="--请选择子类型--"/>

这样就能从action 中得到 一个列表的值了。
   

猜你喜欢

转载自dannyhz.iteye.com/blog/2214077