最后我们来看一下struts.xml里面是怎么配置的呢,
struts.xml:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="jsondefault" namespace="/" extends="json-default"> <action name="grtallDept" class="org.web.EmpAction" method="getallDept"> <result type="json"> <param name="root">deptJson</param> </result> </action> <action name="getEmp" class="org.web.EmpAction" method="getEmp"> <result type="json"> <param name="root">empJson</param> </result> </action> </package> </struts>