Spring MVC框架下 从后台读取数据库并显示在前台页面【笔记自用】

来源:互联网 发布:易语言反编译成源码 编辑:程序博客网 时间:2024/05/15 00:13

1. 书写jsp页面 people.jsp

1. 设计显示格式以及内容显示2. 设计显示内容的范围

2.书写entity实体类 PeopleFormMap.java

书写传入的参数主要包括:要引用的数据库名,以及主键字段h_eventid

3.书写service层

PeopleService  继承底层的 BaseService

4.书写service实现类 PeopleServiceImpl

@peopleservice

5.书写controller层 PeopleController Controller实现 界面和service实现类的数据交互

   @RequestMapping(“/people”)   public class PeopleController extends BaseController{   private PeopleService peopleservice;   @ResponseBody   @RequestMapping("peoplelist")   public String peoplelist(String txtSelect ) throws Exception{    return "success";}}

6.书写js页面

  function initPeopleList(){     var url= rootPath + '/people/findByPage.shtml';     书写想要显示字段内容     封装data{       }   }

7.mapping

书写sql查询语句<mapper namespace="RiskForcastMapper"><select id="" resultType="java.util.HashMap">   select * from .....   </select>
阅读全文
0 0
原创粉丝点击