Struts2 在 select 标签中使用 Map

2024-04-21

您可以轻松地在struts2 select标签中使用List,但是有没有办法在标签中使用Map?如果可以请提供示例代码...

thanx !


在我的动作课上

public class MyAction extends ActionSupport {
   private Map<String, String> map;

   public String execute() throws Exception {
       map = new HashMap<String, String>();
       map.put("abc", "abc");
       map.put("xyz", "xyz");
       return SUCCESS;
   }
}

对于映射到成功的 jsp,请使用类似这样的东西

<s:select list = "map" name = "name" label = "Name" headerKey="" headerValue = "Enter Value"/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Struts2 在 select 标签中使用 Map 的相关文章

随机推荐