1.加入struts的标准jar包
2.加入struts与json的jar包
3.配置web.xml文件
4.action类中代码
public class AjaxAction2 extends ActionSupport { private Mapmap; public Map getMap() { return map; } @Override public String execute() throws Exception { map=new HashMap<>(); map.put("name", "张三"); map.put("age", 15); map.put("address", "杭州"); return super.execute(); } }
5.struts.xml文件的代码
6.网页代码
Insert title here