如何在jsp页面,通过表单增加一个字段,点击提交后,跳转到servlet中,把信息存储在一个哈希表里

再将该对象存储在session作用域的属性内?
没什么头绪,只要讲讲思路和重要的语句怎么写就行了,不需要完整的代码。谢谢!
比如创建了一个hashmap对象,
Map map=new HashMap();
map.put("c", "ccc");
map.put("a", "aaa");
map.put("b", "bbb");
map.put("d", "ddd");
怎么把这个map里的属性值写进session.setAttribute里呢?

servlet写好,在web.xml中写好配置,,,,,jsp的form就递交到这个url

然后,写session就写

session.setAttribute("str",new String("this is test")); 写
String ls_str=null;
ls_str=(String)session.getAttribute("str");读追问

那么怎么添加到hashmap里呢?
比如
Map map=new HashMap();
map.put("c", "ccc");
map.put("a", "aaa");
map.put("b", "bbb");
map.put("d", "ddd");
这个用session.setAttribute怎么写呢?

温馨提示:答案为网友推荐,仅供参考