Struts2 在选择标签中使用 Map [英] Struts2 using Map in select tag
本文介绍了Struts2 在选择标签中使用 Map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你可以很容易地在struts2 select标签中使用List,但是有没有办法在标签中使用Map??如果可能,请提供示例代码...
You can easily use a List in struts2 select tag, but is there a way to use Map in tag?? If it is possible please provide a sample code...
谢谢!
推荐答案
In my action class
In my action class
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,使用这样的东西
For the jsp mapped to success, use some thing like this
<s:select list = "map" name = "name" label = "Name" headerKey="" headerValue = "Enter Value"/>
这篇关于Struts2 在选择标签中使用 Map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文