Struts.xml部分
<package name=" " namespace="/clue" extends="json-default">
<global-results>
<result name="success">/workbench/clue/index.jsp</result>
</global-results>
<action name="getAllClue" class="clueAction" method="getAllClue">
<result type="json">
<param name="root">map</param>
</result>
</action>
</package>
Action部分
public class ClueAction{
private static String SUCCESS = "success";
private ClueVo clueVo;
private PageUtil pageUtil;
private ClueService clueService;
//set、get 方法
@SuppressWarnings("unchecked")
public String getAllClue(){
Map<String,Object> resultMap = clueService.getAllClue(clueVo,pageUtil);
int total = (int)resultMap.get("total");
List<ClueVo> rows = (List<ClueVo>)resultMap.get("clueList");
//因插件要求,返回数据的key必须为“total”和“rows”
map.put("total", total);
map.put("rows", rows);
JsonUtils.writeToJson(map);
return SUCCESS;
}
}
Service部分
public class ClueServiceImpl implements ClueService {
private ClueDao clueDao;
@Override
public Map<String,Object> getAllClue(ClueVo clueVo,PageUti