1.框架
java web 开发中的 概念
- 基础程序
Controller--类:
package cn.nokia.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class HellowController {
@RequestMapping("index")
public @ResponseBody List doindex() {
// TODO Auto-generated method stub
List<Map<String, String> > list = new ArrayList<>();
Map<String, String> map = new HashMap<>();
map.put("age", "24");
map.put("name", "邹伟");
list.add(map);
return list;
}}
Mapper-接口:
package cn.nokia.mapper;
import java.util.List;
import java.util.Map;
public interface kpimapper {
List<Map<String,String>>selectall();
List<Map<String,String>>selectkpi();
}
Service--接口:
package cn.nokia.service;
import java.util.List;
public interface HellowService {
public List doHello();
}
Service impl-类:
package cn.nokia.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import cn.nokia.service.HellowService;
@Service("helloservice")
public class HellowServiceImpl implements HellowService{
@Override
public List doHello(){
List<Map<String, String>> list = new ArrayList<>();
Map<String,String> map = new HashMap<>();
map.put("name", "zouwei");
map.put("age", "24");
list.add(map);
return list;
}
}